[FFmpeg-devel] [PATCH][RFC] ASS decoder/encoder

Aurelien Jacobs aurel
Tue Aug 10 19:00:55 CEST 2010


On Tue, Aug 10, 2010 at 03:51:12PM +0200, Reimar D?ffinger wrote:
> On Mon, Aug 09, 2010 at 03:58:06PM +0200, Aurelien Jacobs wrote:
> > On Sun, Aug 08, 2010 at 11:55:56AM +0200, Reimar D?ffinger wrote:
> > > On Sun, Aug 08, 2010 at 02:26:55AM +0200, Aur?lien Jacobs wrote:
> > > > So third patch tries to implement this by passing extradata untouched
> > > > from decoder to encoder through a new field in AVCodecContext.
> > > > I'm not sure it is the best way to do this, but that's the only working
> > > > way I found.
> > > 
> > > And how is that supposed to work if someone wants to encode data
> > > that was not decoded first?
> > 
> > I not sure to understand what you mean by "not decoded first" (the data
> > has to come from somewhere, right ?). But if I try to imagine, I would
> > say it would work exactly the same as for a video encoder. You have to
> > feed the encoder with parameters plus raw frames. In the case of
> > subtitles, it practically mean fead the encoder with a subtitle_header
> > plus valid AVSubtitle.
> > What problem do you see with this ?
> 
> Well, if an application wants to generate some rather simple subtitles
> (e.g. from plain text) and allow exporting it in all kinds of formats,
> it seems it would like this need to know and support the "header" format
> for each subtitle format.

Oh, OK ! I see where the missunderstanding is !
I don't propose to put the raw header in native format in
subtitle_header.
What I propose is to put the header in ffmpeg's internal intermediate
format, which you could compare to a raw yuv picture stored in a AVFrame.
More precisely, the format of subtitle_header would depend on the
AVSubtitleType being used. For SUBTITLE_ASS, it would contain a standard
ASS header, and for other AVSubtitleType it would be unused for now.

Just to make it extra clear, a SubRip decoder would fill subtitle_header
with a standard ASS header, and it would fill AVSubtitleRect with ASS
formated event line with .type=SUBTITLE_ASS.

> I guess for this case just generating one if none was given would work,
> but e.g. what if an application would just want to change the colour?
> With your example:
> 
> > [V4 Styles]
> > Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
> > Style: Ichigo, Verdana, 32, &Hffd5ff, &Hffffff, &H000000, &H000000, -1, 0, 1, 1, 1, 2, 30, 30, 15, 0, 0
> > Style: Girls, Verdana, 32, &Haaffaa, &Hffffff, &H000000, &H000000, -1, 0, 1, 1, 1, 2, 30, 30, 15, 0, 0
> > Style: Miwa, Verdana, 32, &H80cfff, &Hffffff, &H000000, &H000000, -1, 0, 1, 1, 1, 2, 30, 30, 15, 0, 0
> > Style: Default, Verdana, 32, &Hffffaa, &Hffffff, &H000000, &H000000, -1, 0, 1, 1, 1, 2, 30, 30, 15, 0, 0
> > Style: KaraRomaji, Times New Roman, 36, &Ha0f1a0, &Hffffff, &H366c00, &H366c00, -1, -1, 1, 1, 0, 6, 10, 10, 15, 0, 0
> > Style: Moe, Verdana, 32, &H80ffff, &Hffffff, &H000000, &H000000, -1, 0, 1, 1, 1, 2, 30, 30, 15, 0, 0
> 
> It couldn't do that either without knowing the specifics of
> each subtitle format either.

With the previous explanation, it should now be obvious that an
application only need to know the specifics of each AVSubtitleType,
not of each subtitle format.

Aurel



More information about the ffmpeg-devel mailing list