<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2722.900" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi, </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Ive played around a bit with mplayer and got
some mixed feelings about it.</FONT></DIV>
<DIV><FONT face=Arial size=2>Its a great player, supports many codecs and
maintains perfect avsync for most files</FONT></DIV>
<DIV><FONT face=Arial size=2>but the downside is that video is played back a bit
jerky (not smooth)</FONT></DIV>
<DIV><FONT face=Arial size=2>I believe this is caused by the fact that mplayer
tries to keep a perfect av sync. In order to do this</FONT></DIV>
<DIV><FONT face=Arial size=2>it has to render frames too early or too late.
</FONT></DIV>
<DIV><FONT face=Arial size=2>In fact I mp_msg() the frames rendered too
early/late and the fps count and indeed the frames rendered too early/late is
increasing constantly</FONT></DIV>
<DIV><FONT face=Arial size=2>and fps isn't very stable (25 fps encoded movie is
jumping around 24.1 fps & 25.8 fps)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>After tweaking around a bit I managed to get the
playback much smoother while keeping a good a/v sync</FONT></DIV>
<DIV><FONT face=Arial size=2>for this I had to change the sleep algorithm in
mplayer a bit.</FONT></DIV>
<DIV><FONT face=Arial size=2>I used is something like this (pseudo
code)</FONT></DIV>
<DIV><FONT face=Arial size=2>maybe something like this can b added 2 mplayer
either always on, or as an extra -smoothness option?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT size=2>//============================== SLEEP:
===================================</FONT></DIV>
<DIV><FONT face=Arial size=2>time_frame/=playback_speed;</FONT></DIV>
<DIV><FONT face=Arial size=2>// if av delays is > 40 msec then use mplayers
current algo to get better av sync</FONT></DIV>
<DIV><FONT face="Courier New" size=2>if (avdelay <= -0.04 || avdelay
>=0.04)</FONT></DIV>
<DIV><FONT face="Courier New" size=2>{</FONT></DIV>
<DIV><FONT face="Courier New" size=2> //use mplayers current
sleep algorithm to correct the av sync</FONT></DIV>
<DIV><FONT face="Courier New" size=2> if(time_frame>0.001
&&
!(vo_flags&256))<BR> {<BR>
while (time_frame > 0.000)
time_frame-=GetRelativeTime();<BR> }<BR>}</FONT></DIV>
<DIV><FONT face="Courier New" size=2>else</FONT></DIV>
<DIV><FONT face="Courier New" size=2>{</FONT></DIV>
<DIV><FONT face="Courier New" size=2> // av sync is within 40
msec, goto smoothness mode</FONT></DIV>
<DIV><FONT face="Courier New" size=2> // and output each
frame exactly on time</FONT></DIV>
<DIV><FONT face="Courier New" size=2> if (!drop_frame
&& !frame_time_remaining &&
blit_frame)<BR> {<BR> float
j4 = ((float)(GetTimer() - lastframeout_ts)) /
1000000.0;<BR> while( j4 <
frame_time)<BR>
{<BR> j4 = ((float)(GetTimer() -
lastframeout_ts)) / 1000000.0;<BR>
time_frame-=GetRelativeTime(); // burn the
CPU </FONT></DIV>
<DIV><FONT face="Courier New" size=2>
if (j4 >= frame_time) break;<BR>
} <BR> }</FONT></DIV>
<DIV><FONT face="Courier New" size=2> sh_video->timer -=
time_frame;<BR> d_video->pts -=
time_frame;<BR>}</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Frodo</FONT></DIV></BODY></HTML>