[MEncoder-users] Problems with created vobsub IDXs
Reimar.Doeffinger at gmx.de
Sun Jun 19 10:50:00 CEST 2011
Sorry for the late reply, hope you're still interested, someone caring about
mencoder and looking at the code a bit is always welcome.
On Wed, Jun 15, 2011 at 05:41:08PM -0700, Mike Castle wrote:
> Recently I noticed something. When I use -vobsubout, like in the following:
> ./mencoder -oac copy -ovc copy -vobsubout a.vob -o /dev/null dvd://3
> I often get out of order timestamps in the index like this:
> id: en, index: 0
> timestamp: 00:00:01:401, filepos: 000000000
> timestamp: 00:00:03:370, filepos: 000000800
> timestamp: 00:00:06:639, filepos: 000001800
> timestamp: 00:00:09:376, filepos: 000002000
> timestamp: 00:00:00:931, filepos: 000002800
> timestamp: 00:00:02:632, filepos: 000003000
> timestamp: 00:00:16:466, filepos: 000003800
> timestamp: 00:00:19:794, filepos: 000004800
> If I use streamripper's subtitle2vobsub on the same DVD, I get correct ordering:
> timestamp: 00:00:01:556, filepos: 000000000
> timestamp: 00:00:03:357, filepos: 000000800
> timestamp: 00:00:06:360, filepos: 000001800
> timestamp: 00:00:08:863, filepos: 000002000
> timestamp: 00:00:10:883, filepos: 000002800
> timestamp: 00:00:12:551, filepos: 000003000
> timestamp: 00:00:15:421, filepos: 000003800
> timestamp: 00:00:18:457, filepos: 000004800
> While the timestamps aren't the same, they do seem to actually work.
> This tool has some other issues like not getting the palette right,
> but by mixing and matching parts of IDX files generate by
> subtitle2vobsub and mencoder, I can get something that works.
> Oddly, subtitle2vobsub is derived from mplayer, just from the 0.90pre6 days.
> I have not yet written a tool if there has been a regression, or what.
> I've seen some comments about timestamp problems going back to 2003
> and even a patch floated in 2005, but never finished up.
> Using mplayer, the subtitles on the DVD play correctly, and obviously
> some show up at the wrong time when playing. In tracing through to
> compare mplayer and mencoder, and going through mpcommon.c and
> mencoder.c, I did get kind of lost. I have suspicions about
> mencoder's use of ``v_muxer_time + d_dvdsub->pts - sh_video->pts'' but
> wasn't able to find the equivalent in mpcommon.c for when subtitles
> are actually displayed.
The actual condition is in sub/spudec.c:spudec_heartbeat
However that is just a simple comparison.
The code you'd probably want in mencoder is this from mpcommon.c:
float x = d_dvdsub->pts - refpts;
if (x > -20 && x < 20) // prevent missing subs on pts reset
timestamp = 90000*d_dvdsub->pts;
else timestamp = 90000*curpts;
I suspect that v_muxer_time is the equivalent to curpts,
and the timestamp value you calculate here is what you'd probably
want instead of the "v_muxer_time + d_dvdsub->pts - sh_video->pts".
No promises though, and there's likely some issues with -speed
and -fps options that this won't really work right with I'd suspect.
More information about the MEncoder-users