[FFmpeg-devel] [PATCH 3/4] lavf/concat: compute duration if possible.

Nicolas George nicolas.george at normalesup.org
Fri Feb 22 17:42:10 CET 2013


Le quartidi 4 ventôse, an CCXXI, Stefano Sabatini a écrit :
> > +    for (i = 0; i < cat->nb_files; i++) {
> > +        if (cat->files[i].start_time == AV_NOPTS_VALUE)
> > +            cat->files[i].start_time = time;
> > +        else
> > +            time = cat->files[i].start_time;
> > +        if (cat->files[i].duration == AV_NOPTS_VALUE)
> > +            break;
> > +        time += cat->files[i].duration;
> What if duration is NOPTS_VALUE?

It can not: the line before causes a break if it happens (if the "duration"
directive is missing from the concat script file), thus leaving the next
start_time fields unset, exactly like before.

> And BTW I'm not sure about the assumed semantics of duration, if it
> is:
> max time in file
> or
> max time in file - start time
> 
> (where start time is assumed the first time in the file), and I
> suspect it is treated inconsistently in the codebase. Fixing the
> documentation would really help.

In this particular case, the semantics of start_time and duration is exactly
this: input file #i provides the packets for the time interval from
start_time (inclusive) to start_time+duration (exclusive) in the output
virtual file.

> Also duration is very unreliable in a lot of cases (e.g. when it is
> computed from bitrate and file size).

I suspect you misread the code: the duration field used here is the value
from the script file, not from the slave demuxer. It may not be reliable,
but it is considered authoritative.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130222/a9985453/attachment.asc>


More information about the ffmpeg-devel mailing list