[FFmpeg-devel] [PATCH]Do not change flv codec if user forced a codec_id

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Feb 1 19:59:54 CET 2013


Hi!

Forcing a codec_id for flv files does not work since 1.0 which apart from 
being a long-time feature of FFmpeg breaks decoding some broken files, see 
ticket #2218.

Attached patch fixes forcing codecs for flv files, please review, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 09a77c4..b57929e 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -713,13 +713,13 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
         st = s->streams[i];
         if (stream_type == FLV_STREAM_TYPE_AUDIO) {
             if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
-                flv_same_audio_codec(st->codec, flags)) {
+                (s->audio_codec_id || flv_same_audio_codec(st->codec, flags))) {
                 break;
             }
         } else
         if (stream_type == FLV_STREAM_TYPE_VIDEO) {
             if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
-                flv_same_video_codec(st->codec, flags)) {
+                (s->video_codec_id || flv_same_video_codec(st->codec, flags))) {
                 break;
             }
         } else if (stream_type == FLV_STREAM_TYPE_DATA) {


More information about the ffmpeg-devel mailing list