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

Clément Bœsch ubitux at gmail.com
Fri Nov 25 22:42:52 CET 2011


On Fri, Nov 25, 2011 at 06:31:41PM +0100, Stefano Sabatini wrote:
[...]
> > Being able to burn some crazy subtitles like
> > http://www.youtube.com/watch?v=dacAu3i3864 in FFmpeg with such filter is
> > really great, thank you both for writing this filter.
> > 
> > > A more generic subtitle renderer should be done relying on
> > > libavcodec/libavformat, and writing an internal AVSubtitle to video
> > > renderer engine.
> > 
> > There is indeed places for improvement here, and I'd like to help
> > eventually.
> 
> A possible important todo I'm leaving out is that I'm not supporting
> YUV formats (neither more RGB formats), but since I can't spend much
> time on coding I'd rather push this version.
> 

I agree, the sooner upstream the better.

> Note also that I'm parsing the provided filename with av_get_token()
> in case we need to extend the filter later, by adding more options
> (e.g. like in *movie).

OK.

> -- 
> FFmpeg = Friendly & Fierce Mean Pitiful Exuberant Guru

> From f8e4b1295bf6e6d6f884806fa00060e1fff2b61a Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefasab at gmail.com>
> Date: Sat, 17 Sep 2011 15:52:19 +0200
> Subject: [PATCH] lavfi: add libass based subtitles renderer
> 
> ---
>  configure                |    5 +
>  doc/filters.texi         |    9 ++
>  libavfilter/Makefile     |    1 +
>  libavfilter/allfilters.c |    1 +
>  libavfilter/vf_ass.c     |  223 ++++++++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 239 insertions(+), 0 deletions(-)
>  create mode 100644 libavfilter/vf_ass.c
> 
[...]
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -574,6 +574,15 @@ build.
>  
>  Below is a description of the currently available video filters.
>  
> + at section ass
> +
> +Draw ASS (Advanced Substation Alpha) subtitles on top of input video.
> +
> +To enable compilation of this filter you need to configure FFmpeg with
> + at code{--enable-libass}.
> +
> +This filter accepts in input the name of the ass file to render.
> +

An example would be welcome, even if it is trivial.

[...]
> +#define R(c)  ( (c)>>24)

No risk of undefined behaviour for the MSB?

> +#define G(c)  (((c)>>16)&0xFF)
> +#define B(c)  (((c)>>8) &0xFF)
> +#define A(c)  ( (c)     &0xFF)

This is wrong for alpha actually; it should be something like "0xff-(c) &
0xff". The value is the transparency level: transparency=0x00 →
alpha=0xFF.

(so the other patch where you fix the default value is also wrong)

You can confirm it playing the file with another player: -ass -sub foo.ass
with mplayer for instance.

-- 
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/20111125/be0448cd/attachment.asc>


More information about the ffmpeg-devel mailing list