[libav-api] Set timestamps for muxing after seeking

Espen Jürgensen espenjurgensen at gmail.com
Fri Aug 28 20:40:04 CEST 2015


Hi,

So my application basically transcodes (demuxes, decodes, encodes, muxes)
very much the same way as in doc/examples/transcode.c.

During transcoding, the user may decide to seek backwards in the input
file. I have this working fine with av_seek_frame(). My issue is that the
timestamps passed to the muxer are those from the decoded packets (like in
the transcode.c example), and after seeking backwards a discontinuity
naturally arises so they are no longer monotonically increasing, which
understandably makes the muxer very unhappy.

I'm thinking of a solution where I calculate the length of the jump for
each stream, and then add those to the decoder packet timestamps given to
the muxer, again for each stream. It would be rather cumbersome, and I have
a feeling there is a better way of doing it? I would really appreciate some
suggestions.

My Google-fu was not strong enough to find an answer, and I should add that
I'm fairly new to this.

Best regards,

Espen


More information about the libav-api mailing list