[FFmpeg-devel] [WIP] libass subtitle renderer filter

Stefano Sabatini stefasab at gmail.com
Tue Sep 27 19:54:54 CEST 2011

On date Sunday 2011-09-25 16:20:59 -0700, Baptiste Coudurier encoded:
> On 9/25/11 8:52 AM, Stefano Sabatini wrote:
> > Hi,
> > 
> > as in $subject, usage:
> > 
> > $ ffplay -vf "ass=ff=FreeSerif.ttf:f=SUB.ass" FILE 
> > 
> > This has still problems, maybe something's wrong with how I'm using
> > libass (on the other hand both libass and the ASS format itself are
> > painfully under-specificated so it's not easy to figure out what's
> > wrong).
> > 
> > Todo:
> > * fix rendering
> What's wrong with rendering ?

>From my previous mail:
|The problem with the weird rendering which I observe possibly depends
|on the fact that libass doesn't automatically select the Default
|style, if not specified explicitely on the dialog lines.
|I got the test file converting an SRT to ASS using ffmpeg (and got no
|Style in the dialog lines), so maybe this is a problem which should be
|fixed in the conversion code.

Or in other words, I need to figure out how to deal with the case when
the style is not set in the dialog lines (which style to assume? the
Default one? or use an "hardcoded" style? how is this case supposed to
be handled according to libass and to the (poor) ASS spec?).

> > [...]
> > 
> > YUV path is partly addressed in a patch I got from Baptiste (from the
> > other points of view his variant is more or less equivalent to this
> > one, but my code is funnier to read due to the AssContext).
> > 
> > Note that I don't want to make a generic subtitles renderer of this,
> > but just a simple wrapper around libass.
> > 
> > A more generic subtitle renderer should be done relying on
> > libavcodec/libavformat, and writing an internal AVSubtitle to video
> > renderer engine.

> There are 2 situations: internal subtitle streams and external subtitle
> files
> Also, I don't think using AVSubtitle for text based subtitles is worth it.
> I was more thinking of a generic vf_sub.c subtitle renderer filter,
> similar to sub.c in mplayer, that handles all kind of subtitles files.

> For internal picture subtitle streams, another filter can decode the
> stream to AVSubtitle and burn the picture, maybe the 2 filters can be
> merged.

I confess that I'm not very familiar with how libav* deals with
subtitles, I suppose AVSubtitle should be rich enough to support all
the information contained in a libass "event" (from what you tell . At
this point you should be able to implement:

1) a general subtitle renderer filter, which reads a subtitle file,
extract subtitle "frames" and renders them to video, the same way
libass reads from a file and issues events+images.

2) a general subtitle+video -> video transmedia filter, once we
support subtitles in lavfi.

At the same time I want to start with something easy to implement and
which doesn't require major redesign/review, so a libass filter is
perfectly fine with me at this point.
FFmpeg = Funny and Fascinating Meaningless Prodigious Exuberant Goblin

More information about the ffmpeg-devel mailing list