[FFmpeg-devel] [HACK]Auto-detect ljpg images

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Dec 6 22:40:02 CET 2011


Hi!

Attached allows ffmpeg -i image.ljpg to work without -vcodec mjpeg.
Afaict, ffplay currently cannot show ljpg images.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/img2.c b/libavformat/img2.c
index 18dde55..f4310d8 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -284,6 +284,8 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
         s->split_planes = str && !av_strcasecmp(str + 1, "y");
         st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
         st->codec->codec_id = av_str2id(img_tags, s->path);
+        if (str && !av_strcasecmp(++str, "ljpg"))
+            st->codec->codec_id = CODEC_ID_MJPEG;
     }
     if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO && pix_fmt != PIX_FMT_NONE)
         st->codec->pix_fmt = pix_fmt;


More information about the ffmpeg-devel mailing list