[Libav-user] Real time camera IP RTSP H264

Camera Man i.like.privacy.too at gmail.com
Tue Feb 10 09:07:05 CET 2015

On 02/09/2015 10:54 AM, Renaud BOBIN wrote:

> Hi,
> I have a problem to get the video of my IP camera in real time or 
> almost no latency.
> The camera stream an H264 full HD video (with no audio) on a rtsp link;
> On the embedded web server in Internet Explorer with the ActiveX 
> provided by the camera, I got not latency.
> On mplayer I got no latency (so I know it is possible).
> But with my own program I got 300-400ms of latency.
> I tried many things but is always the same results.

At a minimum, you have to actively disable multithreaded decoding, 
because each decoding thread guarantees one frame of latency (so, if you 
have 4 cores, you have at least 4 frames of latency).

After allocating the context with avcodec_alloc_context3(), but before 
opening it with avcodec_open2(), set the context->thread_type = 0; I 
suppose this should be better documented somewhere.

More information about the Libav-user mailing list