[MPlayer-dev-eng] [PATCH] -vf fixpts=use_timer

Rudolf Polzer divVerent at alientrap.org
Mon Jul 19 09:49:49 CEST 2010


Hello,

I added an option to -vf fixpts that takes over the timer from
mplayer/mencoder's "best known idea" of the current display time.

It is mostly useless in mplayer as mplayer usually generates good pts anyway,
but works there too for completeness.

Its main intention is to support ASS subtitle baking in mencoder, even if the
input video is variable frame rate.

My mencoder profile for embedding subtitles is currently:

[subtitles]
vf-add=fixpts=use_timer,ass,expand=::::1,fixpts
ass=yes
embeddedfonts=yes

It works by having mplayer/mencoder export their timer to a global variable,
and having fixpts=use_timer read that back and use it as replacement pts.

In case of mplayer, I simply could export sh_video->timer (did NOT use
the usually more accurate sh_video->pts, as using that one is quite pointless
as it is exactly what is sent as current timestamp anyway). The feature
therefore is mainly a debugging help in mplayer.

In case of mencoder, sh_video->timer was not available, and sh_video->pts was
not monotonous (and thus bad for e.g. subtitle rendering), so I got no better
idea than using the audio timer instead. As I noticed the audio timer is broken
(positive infinity) for some input video files (e.g. those which use vorbis as
audio codec), I had to port over mplayer's audio PTS generation (which is, if
possible, no longer based on constant bitrate input data sizes, but on output
data sizes of the audio codec, which also works for VBR audio like vorbis).
This also solves almost all failcases of mencoder that I have that previously
needed -mc 0 to encode properly, as apparently this very issue also caused AV
sync to fail in mencoder.

To do this port, I also had to delete the written-only (grep did not find any
other access to it anywhere) delay_corrected variable. I hope that is okay.

If desired, I can split up the changes into separate diffs, however the
fixpts=use_timer feature depends on the mencoder.c audio timer fix, or rather,
causes huge breakage (infinite pts values) on many input video files when added
to the filter chain. Or you can instead download them separately on github:

http://github.com/divVerent/mplayer/commits/divVerent/fix_audio_pts
http://github.com/divVerent/mplayer/commits/divVerent/fixpts_get_audio_pts

http://github.com/divVerent/mplayer/commits/divVerent/integration/fixpts
(integration branch of both + current svn)

I attached my patch to svn r31721 (= git master on git.mplayerhq.hu), and hope
for a review.

Best regards,

Rudolf Polzer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixpts.diff
Type: text/x-diff
Size: 7370 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20100719/0b658d88/attachment.diff>


More information about the MPlayer-dev-eng mailing list