[FFmpeg-devel] [PATCH 0/2] RFC: TEXT subtitle decoder

Clément Bœsch ubitux at gmail.com
Fri May 25 22:50:31 CEST 2012


On Fri, May 25, 2012 at 10:24:01AM -0700, Philip Langdale wrote:
> On 25.05.2012 09:47, Clément Bœsch wrote:
> 
> >
> >Why do you hack into srtdec? srt is a SubRip format, and AFAIK is not
> >related at all to TEXT (TTXT?). Shouldn't you instead write a new
> >lavc/ttxtdec.c (which can be reused into mov/mp4 as well)?
> 
> Well, the reality is that srtdec should be replaced by a textdec - I
> discussed
> that already - by having the srt demuxer produce proper text packets.
> 

Ah I'm sorry I just read the thread right now.

> ttext/tx3g/movtext is MPEG4 Part 17. Although it's tempting to say
> its just
> text, the standard goes way beyond that, and the pascal style
> strings have to
> be accounted for as well. I intend to introduce separate encoders
> and decoders
> for it. This change set has no direct relationship to this work -
> it's a precursor
> to ensure you can get srt out of mkv files sanely.
> 

OK, sorry for the confusion.

Still, it seems to me your first approach was a better one.

Or to be more correct, I think it should be done like this:
 - fix the subrip demuxer (lavf/srtdec.c) to set pkt->duration (it already
   set pkt->pts) and strip out the timing text information from the
   packet.
 - change the srt "raw" muxer into a smarter one using pts & duration (so
   introduce a lavf/srtenc.c and drop the raw one from lavf/rawenc.c)
 - make the subrip decoder (lavc/srtdec.c) use these new fields instead or
   reconstructing them from the packet.
 - then just drop the {"S_TEXT/UTF8", CODEC_ID_TEXT} in matroska like you
   did the first time.

This is almost what is currently done in the MicroDVD design: the demuxer
set the pts/dts packet duration, and the decoder use them. The difference
is that the decoder receives the complete timing text information (and
just ignore them). I think the benefit of this is that it can be remuxed
easily and exactly (MicroDVD is expressed in frame id, so it's a bit
tricky).

Still, I'm not sure about dropping text timing information from the SubRip
packets. In case we really want to have them in the packet (for what
reason?), then I think your first patches are better.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120525/43de65b1/attachment.asc>


More information about the ffmpeg-devel mailing list