[FFmpeg-devel] State of existing infrastructure for subtitle transcoding

Philip Langdale philipl at overt.org
Sun Apr 29 01:03:01 CEST 2012


Hi all,

I'm currently working on an encoder and decoder for tx3g subtitles
(aka: MPEG4 Part 17 subtitles). The format is a bit of a departure
from what we've seen before in that rather than being an embedded
text document like SRT or ASS, it's defined strictly in terms of
the containerized stream with the stream packet pts used to indicate
display time, etc.

I was able to write a simple decoder (simple because it ignores all
styling information) that works like srtenc, so that you can take
an mp4 file with subtitles and, for example, transcode it to an
mkv file with srt subtitles. So that's great.

But I'm having nothing but trouble on the encoder side.

1) The srt decoder assumes that its input is from a raw text file.
If you try and feed it a stream from a matroska file, it will fail
because the timing information is stored in the packet fields and
not as part of the srt text. I assume this applies for ASS to, so
the upshot is we don't actually have decoders that will work for
the kind of transcode scenario I'm aiming for. This one I can fix,
so I'm not so concerned.

2) I can't express subtitle duration in the expected way. From my
reading of the spec, the packet pts value is the time to start
showing the subtitle and you encode the end time as a separate
empty packet with the pts set appropriately. I don't think there's
a way to output two packets for one input packet. Am I missing
something?

Thanks,

--phil


More information about the ffmpeg-devel mailing list