[FFmpeg-devel] [PATCH] Add example seeking_while_remuxing.c

Andrey Utkin andrey.krieger.utkin at gmail.com
Wed Feb 5 00:37:06 CET 2014

2014-02-05 Stefano Sabatini <stefasab at gmail.com>:
> Again, I don't see much difference with remuxing.c and I'd like better
> to integrate seeking in it rather than having to maintain and keep two
> distinct files in synch. The offset can be optional, in case it is not
> ignored. Also I think a more useful use-case is when the user needs to
> specify the start and end of the stream to remux, rather than the part
> to skip.

I tend to agree with you that embedding of seeking demonstration into
remuxing example makes sense. And i also agree that seeking in the
middle of remuxing process is not very practical. But seeking at start
(to demonstrate remuxing within range) is obviously simpler because it
does not involve solving of discontuniuty, which makes things
Simplest seeking demo would just involve av_seek_frame() call before
remuxing loop, and no timestamp shifting. Smart playback apps like
ffplay would calculate start_time appropriately and start playback
correctly, i think. Also some muxers shift timestamps to zero on their
own (surely mpegtsenc does this by default, unsure about others). If
manual shifting is added, then we have to be accurate to not end up
with negative pts or dts when we have input with many elementary
streams, possibly poorly interleaved.

I see the value of the code chunk currently discussed in the
explanation of the problem of fixing timestamps discontinuity, and
these discontinuities may be of any nature, not only a result of
seeking (e.g. timestamp wrapup or stream replacement). In my
experience i had to carefully fix input timestamps discontinuities in
output, because technically poor clients were present. I just felt
willing to document these issues somehow. Maybe API example file is
not good form for that. Also solving such issues require good
knowledge of application environment, i.e. what is possible and what
is not, so it is hard to give general advice.

The subject patch can be considered inactual.

Andrey Utkin

More information about the ffmpeg-devel mailing list