[FFmpeg-devel] [PATCH] avformat/assdec: output ASS packets

Clément Bœsch u at pkh.me
Fri Sep 19 21:05:24 CEST 2014


On Fri, Sep 19, 2014 at 09:00:28PM +0200, wm4 wrote:
> On Fri, 19 Sep 2014 20:49:49 +0200
> Clément Bœsch <u at pkh.me> wrote:
> 
> > After this the order from the original file is stored through readorder
> > when doing ffmpeg -i input.ass -c copy output.mkv.
> > 
> > And now that the ASS muxer honors the ReadOrder, extracting the ass back
> > (without transcoding) restores the original order.
> > 
> > TODO: micro bump
> > ---
> >  libavformat/assdec.c | 25 ++++++++++++++++++-------
> >  1 file changed, 18 insertions(+), 7 deletions(-)
> > 
> > diff --git a/libavformat/assdec.c b/libavformat/assdec.c
> > index a5f792a..f176565 100644
> > --- a/libavformat/assdec.c
> > +++ b/libavformat/assdec.c
> > @@ -29,6 +29,7 @@
> >  
> >  typedef struct ASSContext {
> >      FFDemuxSubtitlesQueue q;
> > +    unsigned readorder;
> >  } ASSContext;
> >  
> >  static int ass_probe(AVProbeData *p)
> > @@ -52,18 +53,26 @@ static int ass_read_close(AVFormatContext *s)
> >      return 0;
> >  }
> >  
> > -static int read_ts(const uint8_t *p, int64_t *start, int *duration)
> > +static int read_dialogue(ASSContext *ass, AVBPrint *dst, const uint8_t *p,
> > +                         int64_t *start, int *duration)
> >  {
> >      int64_t end;
> > +    int layer, pos;
> >      int hh1, mm1, ss1, ms1;
> >      int hh2, mm2, ss2, ms2;
> >  
> > -    if (sscanf(p, "%*[^,],%d:%d:%d%*c%d,%d:%d:%d%*c%d",
> > +    if (sscanf(p, "Dialogue: %d,%d:%d:%d%*c%d,%d:%d:%d%*c%d,%n", &layer,
> 
> What about "Comment: " lines?
> 

We can't store them in ASS. ASS only assume Dialogue lines. You definitely
don't want Comments to appear as Dialogue.

One way of exporting them could be side data.

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140919/fd90b16b/attachment.asc>


More information about the ffmpeg-devel mailing list