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). I decode the frames, then encode them to MJPEG.


I have 2 issues which I haven't gotten past. The simpler one happened when I upgraded libav. I had been linking against an old version, the one that installed by default on raspbian. My jpg images are now about 3 times larger. One would suspect jpg quality but I haven't been able to find anything that changes it.


I have tried various values for these with no change:


    m_av_encode_codec_ctx->bit_rate = 100000;
    m_av_encode_codec_ctx->global_quality = 1;
    m_av_encode_codec_ctx->me_subpel_quality = 1;
    m_av_encode_codec_ctx->compression_level = 30;

Suggestions?


The other issue is a 3 second delay, as far as I can tell in decoding.


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?

I have tried this:


    m_av_decode_codec_ctx->flags |= CODEC_FLAG_LOW_DELAY;
    m_av_decode_codec_ctx->delay = 0;

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

_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to