[mythtv-users] Fun with subtitles and video timing (myth's clock seems fast)

Tim Smith tim at electronghost.co.uk
Sat Nov 7 15:51:31 UTC 2009

On Saturday 07 November 2009 00:42:55 Tim Smith wrote:
> Now here I am playing about with a .mkv and associated .srt file for
>  subtitles in current trunk (revision 22750), mostly because I was having
>  trouble working out how to get the font size bigger to make it
>  wife-readable on a big screen[1].
> Anyway, the subtitles seemed to be *way* in advance of where the dialogue
>  had gotten to; my Cantonese is good enough to work that out at least.
> So I tried it in mplayer. Works fine.
> So, wondering WTH is going on, I open up the .srt and look at the timings.
>  I check the timing in mplayer when the subtitle appears. Perfect.
> I press pause in Myth's internal player and look at the elapsed time and
> compare it to the .srt's timing for when the visible subtitle should
>  appear. Also perfect.
> But wait a minute; the video is at a different place at 4:02 in mythtv's
> internal player.
> So I try a wallclock test. I pause myth's internal player. It says 4:02
>  into the file. I unpause it and watch 60 seconds go by on my system
>  clock[2]. I pause it again after 60 seconds. It says 5:14. Woah! Myth has
>  invented 12 seconds that my system clock didn't notice!
> So I try some video wallclock timing on the same file. Using myth's
>  internal player and mplayer I pause it at the same place (near as dammit),
>  unpause, pause again after 60 seconds of wallclock time. Both are in the
>  same place in the video (allowing for small errors in my initial pause).
>  However, mythtv's elapsed time display has gained 10 seconds this time.
> So the video timing (and audio too) is working great, but mythtv's internal
> wallclock is running fast, causing subtitles to appear early.
> Anyone know where the wallclock lives?

Ah. Got it. The playPos calculation is wandering all over the place as actual 
frame rate does not match alleged frame rate very often.

The tentative fix is simply to replace the computation with a direct use of 
currentFrame->timecode. I'll raise a bug for people to shoot down in flames by 
pointing out unintended side effects.

Tim Smith <tim at electronghost.co.uk>
Palpatine's left leg sues for divorce on grounds of incompatibility. 

More information about the mythtv-users mailing list