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

Michael Niedermayer michaelni at gmx.at
Wed Dec 7 02:24:58 CET 2011


On Tue, Dec 06, 2011 at 10:40:02PM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached allows ffmpeg -i image.ljpg to work without -vcodec mjpeg.
> Afaict, ffplay currently cannot show ljpg images.
> 
> Please comment, Carl Eugen

>  img2.c |    2 ++
>  1 file changed, 2 insertions(+)
> 0f224ccf81a2a95da801d7b66a6fccb9000e3b48  patchimgljpg.diff
> 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;

i would do
if(codec_id == LJPEG)
    codec_id = MJPEG

but your variant is ok too

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111207/fdb4e87c/attachment.asc>


More information about the ffmpeg-devel mailing list