[libav-api] Remuxing audio/video data from a UDP stream.

Andrey Utkin andrey.krieger.utkin at gmail.com
Mon Nov 7 13:41:52 CET 2011

> The problem is that when I try to write a packet with
> av_interleaved_write_frame(), it doesn't write it and complains about
> non-monotonically increasing timestamps.
> My player doesn't use LibAV demuxers, but instead uses self-written ones.
> When the record starts, my player sets up one or two more queues (depending
> on audio presence), where parsed data go.
> Then sets up one or two custom IO contexts and uses av_read_frame to read
> raw parsed video or audio data from those queues.
> Therefore, two different AVpackets came from different queues, have
> completely different timestamps and timebases.

av_interleaved_write_frame does not complain when you push frames from
different substreams in non-monotonic order. It complains when subset
of these pushed frames, that belongs to certain substream, has
non-monotonic timestamps.

> How should I interleave reading from different queues?
> How should I calculate timestamps in case of two streams (queues)?

Don't know how to calculate TS to work with av_*_write_frame. In my
practice, i have MPEG TS live streams, and dts have non-monotonity
moments. I use (AVFormatContext*)->oformat->write_packet(), thus
skipping monotonity checks. Result playbacks well.

Andrey Utkin

More information about the libav-api mailing list