[MPlayer-dev-eng] [PATCH] ve_lavc delayed frames

Loren Merritt lorenm at u.washington.edu
Tue Jul 27 00:49:16 CEST 2004


When encoding to lavc with b-frames, mencoder emits some dummy frames at
the beginning of the output video (because lavc hasn't returned any
compressed frames yet). This causes A-V desync, and (the case that I first
noticed) messes with timestamps in a variable-framerate video.

This patch supresses the dummy frames.

I also noticed that mencoder drops the last few frames (for the same
reason). I don't know a good fix for this: avcodec.h says to feed in some
NULL data at the end. So I tried simply calling put_image(vf, NULL), which
does flush the delayed frames, but doesn't stop them from being encoded as
B-frames based on the NULLs.

--Loren Merritt
-------------- next part --------------
--- libmpcodecs/ve_lavc.c~	2004-07-20 05:06:30.000000000 -0700
+++ libmpcodecs/ve_lavc.c	2004-07-26 01:11:02.000000000 -0700
@@ -776,7 +776,8 @@
 	    pic);
 
            
-    muxer_write_chunk(mux_v,out_size,lavc_venc_context->coded_frame->key_frame?0x10:0);
+    if(lavc_venc_context->coded_frame->pict_type != 0)
+	muxer_write_chunk(mux_v,out_size,lavc_venc_context->coded_frame->key_frame?0x10:0);
         
 #if LIBAVCODEC_BUILD >= 4643
     /* store psnr / pict size / type / qscale */


More information about the MPlayer-dev-eng mailing list