[MPlayer-dev-eng] ogg/mjpeg with corrupted first frame

Alan Curry pacman at theworld.com
Wed Mar 29 08:29:42 CEST 2006


Diego Biurrun writes the following:
>
>On Tue, Mar 21, 2006 at 10:50:27PM +0400, Sergey Khlutchin wrote:
>> There is one file which is normally played in old mplayer1.0try7 but
>> failed to open in the current cvs version.
>>
>> http://www6.elphel.com/downloads/elphel333mjpeg/20060320-170056-20060320-170103-217.ogm
>
>Hmm, it does indeed fail with current CVS (libmpdemux and libavformat)
>as well as with ffplay.  VLC can play it.  Can somebody confirm that it
>worked with pre7?  Could somebody try to pinpoint the date of the
>breakage?
>

That movie has a partial frame before the first frame. It looks like the tail
end of a frame, probably caused by a sloppy cut that didn't respect the frame
boundary.

The partial frame gets far enough in the decoding process to trigger a call
to init_vo (line 911 of vd_ffmpeg.c) but there is no header information (no
SOF marker) so the colorspace is unknown.

The colorspace that gets passed to init_vo is the undisturbed initial value
of avctx->pix_fmt. In the older libavcodec, it's PIX_FMT_YUV420P because
PIX_FMT_YUV420P==0 and the whole struct was memset to 0. In the newer
libavcodec, it's PIX_FMT_NONE, set by avcodec_get_context_defaults.

YUV420P happens to be the correct colorspace for this movie, so it plays
correctly with the older libavcodec, more by accident than by design.

How to fix this properly? Maybe move the init_vo a little later, or maybe
don't call it if the pix_fmt is PIX_FMT_NONE... or maybe force the decoder to
bail out sooner on frames with no SOF.

This makes it work, but is probably not the cleanest solution

Index: libmpcodecs/vd_ffmpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_ffmpeg.c,v
retrieving revision 1.159
diff -u -r1.159 vd_ffmpeg.c
--- libmpcodecs/vd_ffmpeg.c	8 Feb 2006 23:22:29 -0000	1.159
+++ libmpcodecs/vd_ffmpeg.c	29 Mar 2006 06:27:40 -0000
@@ -908,7 +908,7 @@
 
     if(!got_picture) return NULL;	// skipped image
 
-    if(init_vo(sh,avctx->pix_fmt) < 0) return NULL;
+    if(avctx->pix_fmt!=PIX_FMT_NONE && init_vo(sh,avctx->pix_fmt) < 0) return NULL;
 
     if(dr1 && pic->opaque){
         mpi= (mp_image_t*)pic->opaque;




More information about the MPlayer-dev-eng mailing list