[MPlayer-users] patch: no skipped frames anymore

Tuukka Toivonen tuukkat at ee.oulu.fi
Mon Sep 8 15:14:45 CEST 2003


I tried encoding with mencoder using -noskip -skiplimit 0 but it doesn't
work. This is catastrophic in some situations (-ovc copy) and inconvenient
at best. The patch below fixes that (the patch looks complex but actually
it only wraps the skip code inside "if (skip_limit!=0) { ... }" )

Also trivial addition to codecs.conf that adds support for uncompressed
Quicktime yv12 format:

--- mplayer-1.0pre1/etc/codecs.conf	Mon Sep  1 11:29:23 2003
+++ etc/mplayer/codecs.conf	Thu Sep  4 01:37:37 2003
@@ -1559,6 +1559,7 @@
   format 0x20776172
   fourcc i420,I420
   fourcc IYUV,iyuv
+  fourcc yv12 I420
   out I420,IYUV

 videocodec rawyvu9

--- mplayer-1.0pre1/mencoder.c.orig	Wed Aug 13 19:29:00 2003
+++ mplayer-1.0pre1/mencoder.c	Tue Sep  2 22:35:36 2003
@@ -1040,29 +1040,30 @@

 //printf("\r### %5.3f ###\n",v_timer_corr);

-if(v_timer_corr>=(float)mux_v->h.dwScale/mux_v->h.dwRate &&
-    (skip_limit<0 || skip_flag<skip_limit) ){
-    v_timer_corr-=(float)mux_v->h.dwScale/mux_v->h.dwRate;
-    ++skip_flag; // skip
-} else
-while(v_timer_corr<=-(float)mux_v->h.dwScale/mux_v->h.dwRate &&
-    (skip_limit<0 || (-skip_flag)<skip_limit) ){
-    v_timer_corr+=(float)mux_v->h.dwScale/mux_v->h.dwRate;
-    --skip_flag; // dup
-}
+if (skip_limit!=0) {
+	if(v_timer_corr>=(float)mux_v->h.dwScale/mux_v->h.dwRate &&
+	    (skip_limit<0 || skip_flag<skip_limit) ){
+	    v_timer_corr-=(float)mux_v->h.dwScale/mux_v->h.dwRate;
+	    ++skip_flag; // skip
+	} else
+	while(v_timer_corr<=-(float)mux_v->h.dwScale/mux_v->h.dwRate &&
+	    (skip_limit<0 || (-skip_flag)<skip_limit) ){
+	    v_timer_corr+=(float)mux_v->h.dwScale/mux_v->h.dwRate;
+	    --skip_flag; // dup
+	}

-while( (v_pts_corr<=-(float)mux_v->h.dwScale/mux_v->h.dwRate && skip_flag>0)
- || (v_pts_corr<=-2*(float)mux_v->h.dwScale/mux_v->h.dwRate) ){
-    v_pts_corr+=(float)mux_v->h.dwScale/mux_v->h.dwRate;
-    --skip_flag; // dup
+	while( (v_pts_corr<=-(float)mux_v->h.dwScale/mux_v->h.dwRate && skip_flag>0)
+	 || (v_pts_corr<=-2*(float)mux_v->h.dwScale/mux_v->h.dwRate) ){
+	    v_pts_corr+=(float)mux_v->h.dwScale/mux_v->h.dwRate;
+	    --skip_flag; // dup
+	}
+	if( (v_pts_corr>=(float)mux_v->h.dwScale/mux_v->h.dwRate && skip_flag<0)
+	 || (v_pts_corr>=2*(float)mux_v->h.dwScale/mux_v->h.dwRate) )
+	  if(skip_flag<=0){ // we can't skip more than 1 frame now
+	    v_pts_corr-=(float)mux_v->h.dwScale/mux_v->h.dwRate;
+	    ++skip_flag; // skip
+	  }
 }
-if( (v_pts_corr>=(float)mux_v->h.dwScale/mux_v->h.dwRate && skip_flag<0)
- || (v_pts_corr>=2*(float)mux_v->h.dwScale/mux_v->h.dwRate) )
-  if(skip_flag<=0){ // we can't skip more than 1 frame now
-    v_pts_corr-=(float)mux_v->h.dwScale/mux_v->h.dwRate;
-    ++skip_flag; // skip
-  }
-
 } // demuxer2

 ptimer_start = GetTimerMS();



More information about the MPlayer-users mailing list