[FFmpeg-devel] Rendering text-based subtitles

JULIAN GARDNER joolzg at btinternet.com
Sat May 28 03:55:17 CEST 2011

>From: Chris Burel <chrisburel at gmail.com>
>To: ffmpeg-devel at ffmpeg.org
>Sent: Saturday, 28 May 2011, 2:51
>Subject: [FFmpeg-devel] Rendering text-based subtitles
>I'm interested in getting support for rendering text based subtitles, like
>ass and srt.  This would be useful for encoding text-based subtitles to
>xsub.  I've hacked in a patch to get this to work using libass, but I had to
>do some things that seem wrong to get it to work.  I'm writing this to start
>the process of cleaning up this patch so it can be merged in.
>Here's some of the problems I faced:
>Since I'm mainly concerned with playing the result of this process on the
>PS3, I was mainly concerned with getting the xsub encoder to work.  On my
>first pass, I put the rendering code into the xsub encoder.  This proved to
>be problematic for a couple of reasons.  #1, it seemed wrong to have the
>xsub encoder know about how to render ass subtitles.  #2, ass allows events'
>timecodes to overlap, but the PS3 doesn't.  So for example, let's say two
>ass events overlap.  xsub encode needs to adjust the end time of the first
>event to be just before the begin time of the next one.  But the encoder
>doesn't have access to the next event yet, so it can't do that.  To solve
>these issues, I moved the rendering code into the decoder of the ass
>subtitles.  The first problem I encountered here is that the decoder doesn't
>know the output resolution (which libass needs to know).  So right now I
>have a resolution hard-coded in the decoder, which is terrible.  But less
>terrible than not having subtitles if they're timecodes overlap.
>Another problem is that I had to make an addition to a struct in the libass
>library that breaks its ABI.  The author of that library didn't want to
>include my patch because of this.  The change is relatively small, but still
>requires adding some fields to a struct.  I created a bug/issue report for
>this on the libass google code page:
>A couple questions:
>Is this a feature that the maintainers of ffmpeg would like to see merged
>Where does the rendering code really belong?  In the ass decoder?  In the
>ass encoder?  Somewhere else entirely?
>Is linking in libass a problem?
>I wasn't planning on posting the patch yet, because this is my first time
>coding in ffmpeg and I don't want to embarrass myself :-).  But if none of
>my questions make sense without seeing some code, then I'll post it.
>ffmpeg-devel mailing list
>ffmpeg-devel at ffmpeg.org
I would be happy to help on this but im looking to render dvbsubs as hard subtitles.

I have a similar problem to you but in my case i get a start time and timeout, in case of a loss of stream or corruption.

I fixed the decoder/encoder and now can make a ts with dvbsubs that work so was looking at now adding in hard subs,

Let me know if your interested in joining forces to get this working for all streams.

To the ffmpeg guys is there a way or an idea how to do something along the lines of "decode ass/xsub/srt" subtitles and "encode dvbsubs", as we only have -scodec


More information about the ffmpeg-devel mailing list