[MPlayer-dev-eng] [PATCH] Subtitle display is based on audio - should be video

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Oct 2 17:15:21 CEST 2010


On Sat, Oct 02, 2010 at 03:42:16PM +0200, gillou.ray at free.fr wrote:
> the subtitles demuxing code currently base its timestamps on audio
> time.

No, it is based on the "real" time, which MPlayer currently by design
matches the audio time.

> That is, when an A/V desync occurs, you see the subtitles of what
> you are hearing, not what you are seeing. I think this is wrong because
> subtitles timestamps are based on video, typically synced with scenes
> changes.

The vast majority of subtitles contain whatever is spoken in the
video, so no, generally they don't have anything to do with video.
And that's ignoring audio-only files with subtitles.
Worst, though, video time is not at all stable: MPlayer will play
video frames faster or slow or might completely skip them
if video is behind too much.
Thus video time just is no really good time base.

> Moreover, my proposed patch makes the ds_get_packet_sub()
> parameters to actually do what their documentation says.

Not initializing the output parameters is not such a good idea.
I applied a different method.

> You can easily produce the bug giving a -delay option to a subtitled
> movie. I tested various combinations of demuxers and files. The bug
> happens when :
> - ass rendering is disabled
> - subtitles are packed in a container (not red from a text file)
> - with both ffpmeg and mplayer mkv demuxer, and ffmpeg ogg demuxer
> - with muxed ASS or SRT 

I have to admit that this inconsistency is not so good though.

> Another thing: with certain combination of stream types and demuxers
> (e.g. with mplayer mkv demuxer and ASS muxed subs), the resulting bug
> is a bit different. It displays each subtitle from their audio timestamp
> start to their video timestamp end, resulting in overlaps. E.g. if a
> subtitle is from 00:03s to 00:06s, with -delay 2 it is displayed from
> 00:01s to 00:06s. The patch solves this problem too.

Your patch changes nothing concerning audio- vs. video-based timing.
With the buggy ds_get_packet_sub function, the subtitle would be
displayed as soon as it is demuxed instead of in sync.
This might have fixed some slight timing issues with PGS subtitles
I was seeing as well.


More information about the MPlayer-dev-eng mailing list