[FFmpeg-devel] [RFC] General design for subtitles demuxers

Nicolas George nicolas.george at normalesup.org
Wed Jun 13 08:53:27 CEST 2012


Le sextidi 26 prairial, an CCXX, Clément Bœsch a écrit :
> Yet another subtitles thread, addressing this time several issues in a row.
> 
> All the text subtitles formats are small files where it is interesting to
> consider them as such, and not as a stream. In practice I propose the
> following:
> 
> 1) Parse the whole file
> 
>    Just like lavf/assdec or lavf/jacosubdec, the whole file should be parsed on
>    the read_header() callback.
> 
>    Why is it done like this? Because in "format" oriented ("ASS"), the events
>    can be in any order, require looking ahead, or preprocessing the file; when
>    they are muxed ("SSA") the timeline must makes sense, and it doesn't matter
>    since this demuxing belongs to the video demuxer.
> 
>    JACOsub also has that issue, but SubRip as well (remember the event
>    numbers?), and actually all the others (see below).
> 
> 2) Set missing durations
> 
>    Since we now have the complete list of events in a list, it's easy to work
>    on them, and we can just set the packets duration when missing that
>    information: this actually solves in a very simple way the
>    last-to-next-subtitle feature I mentioned several times.
> 
> 3) Sort the events
> 
>    We should then export the sorting of all these subtitles (PTS based) raw


Until now, I agree at 100%.

>    events from lavf/assdec.c.

This part I am not sure I understand. Do you mean that the demuxer is
supposed to translate into ASS?

>    We should take out read_seek2() from lavf/assdec.

Looks reasonable.

Regards,

-- 
  Nicolas George


More information about the ffmpeg-devel mailing list