[Libav-user] How to implement "-re" option with avformat?

Oleg mybrokenbeat at gmail.com
Fri Jul 19 19:11:32 CEST 2013


Hello Massimo,

I'm using PTS values and 1 second timer and have no problems at all. 

Also it's possible to sleep in thread by (cur_pts - prev_pts) value to get the most accurate timing, but of course it consumes more CPU.

But these methods works only for streams where packets ordered by PTS. If it's not a truth, you should respect format's order and use, for example, DTS if it's suitable or reorder packets by PTS. 

Also when using duration value I didn't get accurate timing for most streams.

19.07.2013, в 20:02, Massimo Battistel написал(а):

> Hello,
> I have a similar problem. I need to stream some videos through udp/mpegts. Without flow control memory grows continuously.
> I solved comparing stream time with absolute time a making some Sleep(...) to slow down packet sending.
> 
> I would like to know if a more elegant solution is available.
> 
> thanks
> 
> 
> 
> 
> 2013/7/19 Oleg <mybrokenbeat at gmail.com>
> Player should use PTS value anyway for correct and smooth playback. Are you sure that you're filling PTS correct?
> 19.07.2013, в 19:20, Gyula Hatalyák написал(а):
> 
> > Hi,
> >
> > I am streaming out packets with RTMP output format to Wowza media server.
> > I have a packet buffer as the input of the RTMP muxer.
> > I can send the packets faster than their duration - by av_interleaved_write_frame calls.
> > I send all the packets in the buffer until it is empty, and then wait for new packets to come.
> > The problem is:
> > During playback from Wowza the frames are displayed in the same timing as they were sent with av_interleaved_write_frame calls resulting fast playback and pause/still until the next bunch of packets.
> >
> > With command line ffmpeg I can use "-re" option to make the flow real-time.
> > Is there a lib counterpart of this option?
> > Or must I implement manually this "real-time" option?
> > Why aren't PTS/DTS used by muxer/wowza/player?
> >
> > Thanks for any help in advance.
> > Gyula
> > _______________________________________________
> > Libav-user mailing list
> > Libav-user at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/libav-user
> 
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
> 
> 
> 
> -- 
> Massimo Battistel.
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130719/09e3bf16/attachment.html>


More information about the Libav-user mailing list