diff mencoder.c @ 17659:92ac78a93625

Fix video delay when encoding with B-frames. Encoding delay is adjusted for on-the-fly during encoding. Decoding delay is compensated for by setting an appropriate dwStart on the audio stream (only in muxer_avi at this point).
author corey
date Tue, 21 Feb 2006 09:39:22 +0000
parents 16633b9c0953
children e735c3f740ba
line wrap: on
line diff
--- a/mencoder.c	Mon Feb 20 23:50:40 2006 +0000
+++ b/mencoder.c	Tue Feb 21 09:39:22 2006 +0000
@@ -1394,6 +1394,9 @@
     AV_delay-=audio_delay;
     AV_delay /= playback_speed;
     AV_delay-=mux_a->timer-(mux_v->timer-(v_timer_corr+v_pts_corr));
+    // adjust for encoder delays
+    AV_delay -= (float) mux_a->encoder_delay * mux_a->h.dwScale/mux_a->h.dwRate;
+    AV_delay += (float) mux_v->encoder_delay * mux_v->h.dwScale/mux_v->h.dwRate;
 	// compensate input video timer by av:
         x=AV_delay*0.1f;
         if(x<-max_pts_correction) x=-max_pts_correction; else