[MPlayer-dev-eng] enhancement for yuv4mpeg output driver

D Richard Felker III dalias at aerifal.cx
Thu Jan 20 05:32:07 CET 2005


On Wed, Jan 19, 2005 at 06:20:01PM -0800, Trent Piepho wrote:
> On Wed, 19 Jan 2005, D Richard Felker III wrote:
> > > +	fprintf(yuv_out, "YUV4MPEG2 W%d H%d ", image_width, image_height);
> > > +	if(image_fps>23.975973976 && image_fps<23.976073976) 
> > > +		fprintf(yuv_out, "F24000:1001 ");
> > > +	else if(image_fps>29.96997997 && image_fps<29.97007997) 
> > > +		fprintf(yuv_out, "F30000:1001 ");
> > 
> > There are already good fraction reducing routines in mplayer (or
> > lavc?) that let you specify maximum magnitude for the denominator.
> > They'll make mplayer's stupid float crap into correct values like
> > 30000/1001.
> 
> I found av_reduce() in lavc, but it doesn't work for this.  Depending on what
> I specify for the max, it turns 23.976 into 2996973/125000, 983/41,
> 456427/19037, or 16831/702.  There doesn't seem to be any way to get the
> correct value of 24000/1001.

where did 23.976 come from? did you just type it in yourself? if so
then it's your fault, because this is nowhere near close enough. you
should type either 23.976023976 or 24000/1001. then when mplayer
converts it to float and av_reduce converts it back, it'll get it
right.

if the 23.976 came from the source movie, then av_reduce should
convert it back to whatever it was in the source movie. unfortunately
lots or broken avi files have stupid framerates that aren't exactly
24000/1001 in their headers, due to broken software like mplayer. so
there it's correct for av_reduce to reduce to something different.

> Is it acceptable for the vo_yuv4mpeg module to call a routine from libavcodec? 
> Is there a problem with the new dependency?  If it's ok, I'll make a new patch

hmm, probably not ok. could you just copy and paste the reduce code? i
imagine it's reallt small.

> that uses it to reduce fraction, but it's still necessary to make a special
> case to detect NTSC x/1001 framerates.

no, it's not, and in fact this should not be done. if the error in the
source file is large, it _will_ cause a/v desync to alter the output
framerate like this. if the error is very small just use -fps
24000/1001 to 'correct' it. but always check the a/v sync afterwards!!

rich




More information about the MPlayer-dev-eng mailing list