[Live-devel] 3 second lag

Len Day led at lenday.com
Thu Sep 14 21:28:44 PDT 2017


Hi,


I'm using Live555 to capture an H.264 RTSP stream from a camera and 
using libav to process it. I'm using libav 12.1 that I downloaded the 
other night and built from source for a Raspberry Pi (ARM).


The short statement:

I see a 3 second lag in the video stream coming out. Does libav buffer 
and is there a way to stop it from doing so to get the realtime stream?


The longer statement:


I have the camera set for 3 frames per second with a key frame every 2 
seconds. It always sends a key frame as the first frame with SPS and PPS 
NALs. Calls to avcodec_receive_frame return EAGAIN (-11) for the first 
several calls with the first successful frame 3 seconds in.  It's 3 
seconds behind ever after.


Here's some debug output. "Got a complete frame" means av_parser_parse2 
set pkt->size to a non-0 number. "Got a picture" means 
avcodec_receive_frame returned a number > 0. The code is patterned after 
the decode_video.c example I got from your site. As far as I can tell 
the first frame should be decodable.


09/14/17 20:51:13: Started playing session
09/14/17 20:51:13: 25 byte frame received
09/14/17 20:51:13: 8 byte frame received
09/14/17 20:51:14: 9 byte frame received
09/14/17 20:51:14: 50945 byte frame received

09/14/17 20:51:14: 6645 byte frame received
09/14/17 20:51:14: @@@@ Got a complete frame
09/14/17 20:51:14: Error -11 in receive_frame
09/14/17 20:51:14: 9929 byte frame received
09/14/17 20:51:14: @@@@ Got a complete frame
09/14/17 20:51:14: Error -11 in receive_frame
09/14/17 20:51:14: 13226 byte frame received
09/14/17 20:51:14: @@@@ Got a complete frame
09/14/17 20:51:15: Error -11 in receive_frame
09/14/17 20:51:15: 11078 byte frame received
09/14/17 20:51:15: @@@@ Got a complete frame
09/14/17 20:51:15: Error -11 in receive_frame
09/14/17 20:51:15: 13621 byte frame received
09/14/17 20:51:15: @@@@ Got a complete frame
09/14/17 20:51:15: Error -11 in receive_frame
09/14/17 20:51:15: 25 byte frame received
09/14/17 20:51:15: @@@@ Got a complete frame
09/14/17 20:51:16: @@@@@@@@@@@@@@@@ Got a picture!
09/14/17 20:51:16: 8 byte frame received
09/14/17 20:51:16: 9 byte frame received
09/14/17 20:51:16: 50822 byte frame received
09/14/17 20:51:16: 6361 byte frame received
09/14/17 20:51:16: @@@@ Got a complete frame
09/14/17 20:51:16: @@@@@@@@@@@@@@@@ Got a picture!
09/14/17 20:51:16: 10171 byte frame received
09/14/17 20:51:16: @@@@ Got a complete frame
09/14/17 20:51:16: @@@@@@@@@@@@@@@@ Got a picture!
09/14/17 20:51:16: 13342 byte frame received
09/14/17 20:51:16: @@@@ Got a complete frame
09/14/17 20:51:17: 10695 byte frame received
09/14/17 20:51:17: @@@@ Got a complete frame
09/14/17 20:51:17: @@@@@@@@@@@@@@@@ Got a picture!
09/14/17 20:51:17: 13651 byte frame received
09/14/17 20:51:17: @@@@ Got a complete frame
09/14/17 20:51:17: 25 byte frame received
09/14/17 20:51:17: @@@@ Got a complete frame
09/14/17 20:51:18: @@@@@@@@@@@@@@@@ Got a picture!
09/14/17 20:51:18: 8 byte frame received
09/14/17 20:51:18: 9 byte frame received
09/14/17 20:51:18: 51065 byte frame received
09/14/17 20:51:18: 6614 byte frame received
09/14/17 20:51:18: @@@@ Got a complete frame
09/14/17 20:51:18: @@@@@@@@@@@@@@@@ Got a picture!

The camera is a Sunba 601. I'm also using libav to encode the frames 
into JPGs, that seems to be working fine. I'm pretty sure based on the 
above the lag is in the decode, not the encode.


TIA,

Len




More information about the live-devel mailing list