From: Zhao Zhili <quinkblack-at-foxmail.com@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Cc: Zhao Zhili <zhilizhao@tencent.com> Subject: [FFmpeg-devel] [PATCH] avformat/flvenc: Specify codec tag with MKTAG Date: Fri, 16 May 2025 22:24:07 +0800 Message-ID: <tencent_F36F55DDA90E6EA4A54C731FA84FF3EB5305@qq.com> (raw) From: Zhao Zhili <zhilizhao@tencent.com> ffmpeg -i input.mp4 -c copy -tag:v av01 output.flv [flv @ 0x143204080] Tag av01 incompatible with output codec id '225' (10va) --- libavformat/flvenc.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index f026f0e53b..e92828b197 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -52,9 +52,9 @@ static const AVCodecTag flv_video_codec_ids[] = { { AV_CODEC_ID_VP6, FLV_CODECID_VP6 }, { AV_CODEC_ID_VP6A, FLV_CODECID_VP6A }, { AV_CODEC_ID_H264, FLV_CODECID_H264 }, - { AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') }, - { AV_CODEC_ID_AV1, MKBETAG('a', 'v', '0', '1') }, - { AV_CODEC_ID_VP9, MKBETAG('v', 'p', '0', '9') }, + { AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1') }, + { AV_CODEC_ID_AV1, MKTAG('a', 'v', '0', '1') }, + { AV_CODEC_ID_VP9, MKTAG('v', 'p', '0', '9') }, { AV_CODEC_ID_NONE, 0 } }; @@ -69,10 +69,10 @@ static const AVCodecTag flv_audio_codec_ids[] = { { AV_CODEC_ID_PCM_MULAW, FLV_CODECID_PCM_MULAW >> FLV_AUDIO_CODECID_OFFSET }, { AV_CODEC_ID_PCM_ALAW, FLV_CODECID_PCM_ALAW >> FLV_AUDIO_CODECID_OFFSET }, { AV_CODEC_ID_SPEEX, FLV_CODECID_SPEEX >> FLV_AUDIO_CODECID_OFFSET }, - { AV_CODEC_ID_OPUS, MKBETAG('O', 'p', 'u', 's') }, - { AV_CODEC_ID_FLAC, MKBETAG('f', 'L', 'a', 'C') }, - { AV_CODEC_ID_AC3, MKBETAG('a', 'c', '-', '3') }, - { AV_CODEC_ID_EAC3, MKBETAG('e', 'c', '-', '3') }, + { AV_CODEC_ID_OPUS, MKTAG('O', 'p', 'u', 's') }, + { AV_CODEC_ID_FLAC, MKTAG('f', 'L', 'a', 'C') }, + { AV_CODEC_ID_AC3, MKTAG('a', 'c', '-', '3') }, + { AV_CODEC_ID_EAC3, MKTAG('e', 'c', '-', '3') }, { AV_CODEC_ID_NONE, 0 } }; @@ -348,7 +348,11 @@ static void write_metadata(AVFormatContext *s, unsigned int ts) } put_amf_string(pb, "videocodecid"); - put_amf_double(pb, flv->video_par->codec_tag); + uint32_t tag = flv->video_par->codec_tag; + // check and convert to fourcc + if (tag & 0xFFFFFF00) + tag = av_bswap32(tag); + put_amf_double(pb, tag); } if (flv->audio_par) { @@ -365,7 +369,11 @@ static void write_metadata(AVFormatContext *s, unsigned int ts) put_amf_bool(pb, flv->audio_par->ch_layout.nb_channels == 2); put_amf_string(pb, "audiocodecid"); - put_amf_double(pb, flv->audio_par->codec_tag); + uint32_t tag = flv->audio_par->codec_tag; + // check and convert to fourcc + if (tag & 0xFFFFFF00) + tag = av_bswap32(tag); + put_amf_double(pb, tag); } if (flv->data_par) { -- 2.46.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2025-05-16 14:24 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-05-16 14:24 Zhao Zhili [this message] 2025-05-16 14:52 ` Timo Rothenpieler 2025-05-16 15:59 ` Zhao Zhili 2025-05-16 16:27 ` Timo Rothenpieler 2025-05-16 17:10 ` Zhao Zhili 2025-05-16 17:18 ` Zhao Zhili 2025-05-16 17:24 ` Zhao Zhili 2025-05-16 17:39 ` Timo Rothenpieler 2025-05-17 4:35 ` Zhao Zhili 2025-05-17 11:14 ` Timo Rothenpieler 2025-05-17 14:05 ` Zhao Zhili 2025-05-17 15:43 ` Timo Rothenpieler 2025-05-17 23:38 ` Michael Niedermayer
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=tencent_F36F55DDA90E6EA4A54C731FA84FF3EB5305@qq.com \ --to=quinkblack-at-foxmail.com@ffmpeg.org \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=zhilizhao@tencent.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git