[Libav-user] FFmpeg internal buffering

Rohit Krishnan rohitkrishnan101 at gmail.com
Tue Mar 8 20:24:18 CET 2016


I am using libFFmpeg to mux h264 and aac packets into an flv container and streaming that via rtmp.

I want to be able to detect when frames are being sent to the server or the size of the internal buffer, in order to detect the network lag and apply variable bit-rate. However, when I clock the time it takes for av_write_frame, it is much too fast for it to be syncronous (so we can't use this to detect network speed).

I already tried calling av_write_frame with a null parameter (to flush data) every frame, and also directly calling avio_flush but the bitrate is still too high. So, I am wondering if there is another buffer that I am missing (such as a socket-level buffer).

I also tried to print the AVIOContext->buf_end, buffer_size, and buf_ptr values but none of those are indicative of my network speed getting throttled (when I limit the bandwidth on my router, I would expect the buffer size to increase).

tl;dr - I would like to know how to properly detect packets being sent to the server, or the network speed lagging compared to my av_write_frame calls.

If it makes a difference, this is being run on an arm-v7a Android device.

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

More information about the Libav-user mailing list