[Ffmpeg-devel] [PATCH] MJPEG wrongly displayed with vertical YUV422

Eric Piel Eric.Piel
Sun May 28 00:20:00 CEST 2006

(please CC: me as I'm not subscribed to this mailing list)


ffmpeg doesn't handle the mjpeg files with a "vertical" YUV422. Here is 
an example:
* A fine video: http://pieleric.free.fr/ffmpeg/sevilla-mjpeg-yuv422h.avi 
(directly from my camera)
* Mostly same video which "ffplay" displays with wrong colors: 
http://pieleric.free.fr/ffmpeg/sevilla-mjpeg-yuv422v.avi (lossless 
rotation of the previous file)
(both files are 9 Mb)

Actually there is even a comment in mjpeg.c which explains the problem : 
/* XXX: not complete test ! */

The test "switch((s->h_count[0] << 4) | s->v_count[0]) {" needs to also 
handle 0x12. Like 0x21, it's also YUV422 but this one is "vertical". The 
problem is that there is currently no PIX_FMT_* in ffmpeg which 
corresponds to this coding. So here is a patch (against SVN 5414) to add 
the support for this format. It adds the types PIX_FMT_YUV422VP and 
PIX_FMT_YUVJ422VP. With this patch I can correctly display both videos :-)

Let me know if that's the right way to fix the bug. Also, I've added 
PIX_FMT_YUV*422VP to the minimum of places as possible, maybe I forgot 
some places...


PS: If anyone is interested I can provide my script to do lossless 
rotation on mjpeg movies ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-mjpeg-yuv422-vertical-handling.patch
Type: text/x-patch
Size: 3276 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060528/ff711434/attachment.bin>

More information about the ffmpeg-devel mailing list