[MPlayer-dev-eng] smooth playback vs good avsync
Frodo
csharprules at hotmail.com
Thu Jan 9 08:19:57 CET 2003
Hi,
Ive played around a bit with mplayer and got some mixed feelings about it.
Its a great player, supports many codecs and maintains perfect avsync for most files
but the downside is that video is played back a bit jerky (not smooth)
I believe this is caused by the fact that mplayer tries to keep a perfect av sync. In order to do this
it has to render frames too early or too late.
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
and fps isn't very stable (25 fps encoded movie is jumping around 24.1 fps & 25.8 fps)
After tweaking around a bit I managed to get the playback much smoother while keeping a good a/v sync
for this I had to change the sleep algorithm in mplayer a bit.
I used is something like this (pseudo code)
maybe something like this can b added 2 mplayer either always on, or as an extra -smoothness option?
//============================== SLEEP: ===================================
time_frame/=playback_speed;
// if av delays is > 40 msec then use mplayers current algo to get better av sync
if (avdelay <= -0.04 || avdelay >=0.04)
{
//use mplayers current sleep algorithm to correct the av sync
if(time_frame>0.001 && !(vo_flags&256))
{
while (time_frame > 0.000) time_frame-=GetRelativeTime();
}
}
else
{
// av sync is within 40 msec, goto smoothness mode
// and output each frame exactly on time
if (!drop_frame && !frame_time_remaining && blit_frame)
{
float j4 = ((float)(GetTimer() - lastframeout_ts)) / 1000000.0;
while( j4 < frame_time)
{
j4 = ((float)(GetTimer() - lastframeout_ts)) / 1000000.0;
time_frame-=GetRelativeTime(); // burn the CPU
if (j4 >= frame_time) break;
}
}
sh_video->timer -= time_frame;
d_video->pts -= time_frame;
}
Frodo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20030109/38cad0b5/attachment.htm>
More information about the MPlayer-dev-eng
mailing list