Docker Community Forums

Share and learn in the Docker community.

Receive RTSP stream within docker container

docker

(Waynepro) #1

I am trying to decode a camera rtsp stream with ffmpeg_libs within a ubuntu docker container. The ffmpeg debug output seems to show (Docker Run Log) that it receives an SPS (nalu 7) and PPS (nalu 8), but nothing after that. It times out, retries, etc. That doesn’t really make sense to me.

The same code compiled and run locally seems to work OK (Local Run Log). After receiving the SPS and PPS, it then finds an IDR (nalu 5) and subsequent coded pics (nalu 1).

BTW, if I decode a file, the code works fine both locally and in docker container. So, the basic ffmpeg_lib decode is working. The difficulty is with the stream interface.

The camera uses digest authentication. Perhaps, authentication through the docker interface, or maybe port access, or something is the issue? I’m not much of a networking guy, so I’m really lost at this point.

The ffmpeg logs are below (I hope they aren’t too long. I put in drop down Summary blocks), and my docker run command is:

docker run -it --name VideoRx videorx:latest (I’ve also tried with -p 554)

Any help will be very much appreciated.
Thanks,
Wayne

**** Docker Run Log ****

Summary

avformat_version(): 3756900 Build: 3756900 Ident: Lavf57.83.100
avlog(): old: 32 new: 56
avformat_open_input(): rtsp://admin:pubpsswd@192.168.1.237
Probing rtsp score:100 size:0
[tcp @ 0x56263b430a20] No default whitelist set
[rtsp @ 0xaddr1] Sending:
OPTIONS rtsp://192.168.1.237:554 RTSP/1.0
CSeq: 1
User-Agent: Lavf57.83.100


[rtsp @ 0xaddr1] line=‘RTSP/1.0 200 OK’
[rtsp @ 0xaddr1] line=‘CSeq: 1’
[rtsp @ 0xaddr1] line=‘Public: OPTIONS, DESCRIBE, PLAY, PAUSE, SETUP, TEARDOWN, SET_PARAMETER, GET_PARAMETER’
[rtsp @ 0xaddr1] line=‘Date: Thu, Aug 02 2018 15:53:00 GMT’
[rtsp @ 0xaddr1] line=’’
[rtsp @ 0xaddr1] Sending:
DESCRIBE rtsp://192.168.1.237:554 RTSP/1.0
Accept: application/sdp
CSeq: 2
User-Agent: Lavf57.83.100


[rtsp @ 0xaddr1] line=‘RTSP/1.0 401 Unauthorized’
[rtsp @ 0xaddr1] line=‘CSeq: 2’
[rtsp @ 0xaddr1] line=‘WWW-Authenticate: Digest realm=“IP Camera(C1003)”, nonce=“129b254c8da4e0ffb530f64f79938bcd”, stale=“FALSE”’
[rtsp @ 0xaddr1] line=‘Date: Thu, Aug 02 2018 15:53:00 GMT’
[rtsp @ 0xaddr1] line=’’
[rtsp @ 0xaddr1] Sending:
DESCRIBE rtsp://192.168.1.237:554 RTSP/1.0
Accept: application/sdp
CSeq: 3
User-Agent: Lavf57.83.100
Authorization: Digest username=“admin”, realm=“IP Camera(C1003)”, nonce=“129b254c8da4e0ffb530f64f79938bcd”, uri=“rtsp://192.168.1.237:554”, response=“e7a57f2387890db5547c997d5876e309”


[rtsp @ 0xaddr1] line=‘RTSP/1.0 200 OK’
[rtsp @ 0xaddr1] line=‘CSeq: 3’
[rtsp @ 0xaddr1] line=‘Content-Type: application/sdp’
[rtsp @ 0xaddr1] line=‘Content-Base: rtsp://192.168.1.237:554/’
[rtsp @ 0xaddr1] line=‘Content-Length: 587’
[rtsp @ 0xaddr1] line=’’
[rtsp @ 0xaddr1] SDP:
v=0
o=- 1533225180072336 1533225180072336 IN IP4 192.168.1.237
s=Media Presentation
e=NONE
b=AS:5050
t=0 0
a=control:rtsp://192.168.1.237:554/
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:5000
a=recvonly
a=x-dimensions:1280,720
a=control:rtsp://192.168.1.237:554/trackID=1
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z01AH42NQCgC3/gLcBAQFAAAD6AAAnEDoYACZHAACsQy7y40MABMjgABWIZd5cKA,aO44gA==
a=Media_header:MEDIAINFO=494D4B48010200000400000100000000000000000000000000000000000000000000000000000000;
a=appversion:1.0

[rtsp @ 0xaddr1] sdp: v=‘0’
[rtsp @ 0xaddr1] sdp: o=’- 1533225180072336 1533225180072336 IN IP4 192.168.1.237’
[rtsp @ 0xaddr1] sdp: s=‘Media Presentation’
[rtsp @ 0xaddr1] sdp: e=‘NONE’
[rtsp @ 0xaddr1] sdp: b=‘AS:5050’
[rtsp @ 0xaddr1] sdp: t=‘0 0’
[rtsp @ 0xaddr1] sdp: a=‘control:rtsp://192.168.1.237:554/’
[rtsp @ 0xaddr1] sdp: m=‘video 0 RTP/AVP 96’
[rtsp @ 0xaddr1] sdp: c=‘IN IP4 0.0.0.0’
[rtsp @ 0xaddr1] sdp: b=‘AS:5000’
[rtsp @ 0xaddr1] sdp: a=‘recvonly’
[rtsp @ 0xaddr1] sdp: a=‘x-dimensions:1280,720’
[rtsp @ 0xaddr1] sdp: a=‘control:rtsp://192.168.1.237:554/trackID=1’
[rtsp @ 0xaddr1] sdp: a=‘rtpmap:96 H264/90000’
[rtsp @ 0xaddr1] video codec set to: h264
[rtsp @ 0xaddr1] sdp: a=‘fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z01AH42NQCgC3/gLcBAQFAAAD6AAAnEDoYACZHAACsQy7y40MABMjgABWIZd5cKA,aO44gA==’
[rtsp @ 0xaddr1] RTP Profile IDC: 42 Profile IOP: 0 Level: 29
[rtsp @ 0xaddr1] RTP Packetization Mode: 1
[rtsp @ 0xaddr1] Extradata set to 0x56263b4329d0 (size: 60)
[rtsp @ 0xaddr1] sdp: a=‘Media_header:MEDIAINFO=494D4B48010200000400000100000000000000000000000000000000000000000000000000000000;’
[rtsp @ 0xaddr1] sdp: a=‘appversion:1.0’
[rtp @ 0x56263b432c60] No default whitelist set
[udp @ 0x56263b433480] No default whitelist set
[udp @ 0x56263b433480] end receive buffer size reported is 131072
[udp @ 0x56263b443980] No default whitelist set
[udp @ 0x56263b443980] end receive buffer size reported is 131072
[rtsp @ 0xaddr1] Sending:
SETUP rtsp://192.168.1.237:554/trackID=1 RTSP/1.0
Transport: RTP/AVP/UDP;unicast;client_port=21992-21993
CSeq: 4
User-Agent: Lavf57.83.100
Authorization: Digest username=“admin”, realm=“IP Camera(C1003)”, nonce=“129b254c8da4e0ffb530f64f79938bcd”, uri=“rtsp://192.168.1.237:554/trackID=1”, response=“c4b86e4819bedea0e254c044a93085ce”


[rtsp @ 0xaddr1] line=‘RTSP/1.0 200 OK’
[rtsp @ 0xaddr1] line=‘CSeq: 4’
[rtsp @ 0xaddr1] line=‘Session: 420467284;timeout=60’
[rtsp @ 0xaddr1] line=‘Transport: RTP/AVP/UDP;unicast;client_port=21992-21993;server_port=8328-8329;ssrc=2aa2c277;mode=“play”’
[rtsp @ 0xaddr1] line=‘Date: Thu, Aug 02 2018 15:53:00 GMT’
[rtsp @ 0xaddr1] line=’’
[rtsp @ 0xaddr1] setting jitter buffer size to 500
[rtsp @ 0xaddr1] hello state=0
[rtsp @ 0xaddr1] Sending:
PLAY rtsp://192.168.1.237:554/ RTSP/1.0
Range: npt=0.000-
CSeq: 5
User-Agent: Lavf57.83.100
Session: 420467284
Authorization: Digest username=“admin”, realm=“IP Camera(C1003)”, nonce=“129b254c8da4e0ffb530f64f79938bcd”, uri=“rtsp://192.168.1.237:554/”, response=“82c6c0f1fadea3739846866e8e50e855”


[rtsp @ 0xaddr1] line=‘RTSP/1.0 200 OK’
[rtsp @ 0xaddr1] line=‘CSeq: 5’
[rtsp @ 0xaddr1] line=‘Session: 420467284’
[rtsp @ 0xaddr1] line=‘RTP-Info: url=rtsp://192.168.1.237:554/trackID=1;seq=43938;rtptime=4022155312’
[rtsp @ 0xaddr1] line=‘Date: Thu, Aug 02 2018 15:53:00 GMT’
[rtsp @ 0xaddr1] line=’’
avformat_open_input(): Success erc: 0
[h264 @ 0xaddr2] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0xaddr2] nal_unit_type: 8, nal_ref_idc: 3
[rtsp @ 0xaddr1] UDP timeout, retrying with TCP
[rtsp @ 0xaddr1] Sending:
PAUSE rtsp://192.168.1.237:554/ RTSP/1.0
CSeq: 6
User-Agent: Lavf57.83.100
Session: 420467284
Authorization: Digest username=“admin”, realm=“IP Camera(C1003)”, nonce=“129b254c8da4e0ffb530f64f79938bcd”, uri=“rtsp://192.168.1.237:554/”, response=“eb2dd917591fa4604fe03e77c8962f90”


[rtsp @ 0xaddr1] line=‘RTSP/1.0 551 Option not supported’
[rtsp @ 0xaddr1] line=‘CSeq: 6’
[rtsp @ 0xaddr1] line=‘Session: 420467284’
[rtsp @ 0xaddr1] line=‘Date: Thu, Aug 02 2018 15:53:10 GMT’
[rtsp @ 0xaddr1] line=’’
[rtsp @ 0xaddr1] method PAUSE failed: 551 Option not supported
[rtsp @ 0xaddr1] CSeq: 6
Session: 420467284
Date: Thu, Aug 02 2018 15:53:10 GMT

[h264 @ 0xaddr2] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0xaddr2] nal_unit_type: 8, nal_ref_idc: 3
[rtsp @ 0xaddr1] stream 0: start_time: -102481911520608.625 duration: -102481911520608.625
[rtsp @ 0xaddr1] format: start_time: -9223372036854.775 duration: -9223372036854.775 bitrate=0 kb/s
[rtsp @ 0xaddr1] Could not find codec parameters for stream 0 (Video: h264, 1 reference frame, none(left)): unspecified size
Consider increasing the value for the ‘analyzeduration’ and ‘probesize’ options
avformat_find_stream_info(): Success erc: 0
[rtsp @ 0xaddr1] Sending:
TEARDOWN rtsp://192.168.1.237:554/ RTSP/1.0
CSeq: 7
User-Agent: Lavf57.83.100
Session: 420467284
Authorization: Digest username=“admin”, realm=“IP Camera(C1003)”, nonce=“129b254c8da4e0ffb530f64f79938bcd”, uri=“rtsp://192.168.1.237:554/”, response=“0f22777194800ec26fa371556dbffc85”


cmd>

**** Local Run Log ****

Summary

avformat_version(): 3804260 Build: 3804260 Ident: Lavf58.12.100
avlog(): old: 16 new: 56
avformat_open_input(): rtsp://admin:pubpsswd@192.168.1.237
Probing rtsp score:100 size:0
[tcp @ 0x7f8b16d00b80] No default whitelist set
[rtsp @ 0xaddr1] Sending:
OPTIONS rtsp://192.168.1.237:554 RTSP/1.0
CSeq: 1
User-Agent: Lavf58.12.100


[rtsp @ 0xaddr1] line=‘RTSP/1.0 200 OK’
[rtsp @ 0xaddr1] line=‘CSeq: 1’
[rtsp @ 0xaddr1] line=‘Public: OPTIONS, DESCRIBE, PLAY, PAUSE, SETUP, TEARDOWN, SET_PARAMETER, GET_PARAMETER’
[rtsp @ 0xaddr1] line=‘Date: Thu, Aug 02 2018 15:52:01 GMT’
[rtsp @ 0xaddr1] line=’’
[rtsp @ 0xaddr1] Sending:
DESCRIBE rtsp://192.168.1.237:554 RTSP/1.0
Accept: application/sdp
CSeq: 2
User-Agent: Lavf58.12.100


[rtsp @ 0xaddr1] line=‘RTSP/1.0 401 Unauthorized’
[rtsp @ 0xaddr1] line=‘CSeq: 2’
[rtsp @ 0xaddr1] line=‘WWW-Authenticate: Digest realm=“IP Camera(C1003)”, nonce=“d91c2ea9ccfdb9ec1cf3367d5a09d11a”, stale=“FALSE”’
[rtsp @ 0xaddr1] line=‘Date: Thu, Aug 02 2018 15:52:01 GMT’
[rtsp @ 0xaddr1] line=’’
[rtsp @ 0xaddr1] Sending:
DESCRIBE rtsp://192.168.1.237:554 RTSP/1.0
Accept: application/sdp
CSeq: 3
User-Agent: Lavf58.12.100
Authorization: Digest username=“admin”, realm=“IP Camera(C1003)”, nonce=“d91c2ea9ccfdb9ec1cf3367d5a09d11a”, uri=“rtsp://192.168.1.237:554”, response=“bd9433d94b9e5b4746d72ed76d8c6c40”


[rtsp @ 0xaddr1] line=‘RTSP/1.0 200 OK’
[rtsp @ 0xaddr1] line=‘CSeq: 3’
[rtsp @ 0xaddr1] line=‘Content-Type: application/sdp’
[rtsp @ 0xaddr1] line=‘Content-Base: rtsp://192.168.1.237:554/’
[rtsp @ 0xaddr1] line=‘Content-Length: 587’
[rtsp @ 0xaddr1] line=’’
[rtsp @ 0xaddr1] SDP:
v=0
o=- 1533225121138841 1533225121138841 IN IP4 192.168.1.237
s=Media Presentation
e=NONE
b=AS:5050
t=0 0
a=control:rtsp://192.168.1.237:554/
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:5000
a=recvonly
a=x-dimensions:1280,720
a=control:rtsp://192.168.1.237:554/trackID=1
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z01AH42NQCgC3/gLcBAQFAAAD6AAAnEDoYACZHAACsQy7y40MABMjgABWIZd5cKA,aO44gA==
a=Media_header:MEDIAINFO=494D4B48010200000400000100000000000000000000000000000000000000000000000000000000;
a=appversion:1.0

[rtsp @ 0xaddr1] sdp: v=‘0’
[rtsp @ 0xaddr1] sdp: o=’- 1533225121138841 1533225121138841 IN IP4 192.168.1.237’
[rtsp @ 0xaddr1] sdp: s=‘Media Presentation’
[rtsp @ 0xaddr1] sdp: e=‘NONE’
[rtsp @ 0xaddr1] sdp: b=‘AS:5050’
[rtsp @ 0xaddr1] sdp: t=‘0 0’
[rtsp @ 0xaddr1] sdp: a=‘control:rtsp://192.168.1.237:554/’
[rtsp @ 0xaddr1] sdp: m=‘video 0 RTP/AVP 96’
[rtsp @ 0xaddr1] sdp: c=‘IN IP4 0.0.0.0’
[rtsp @ 0xaddr1] sdp: b=‘AS:5000’
[rtsp @ 0xaddr1] sdp: a=‘recvonly’
[rtsp @ 0xaddr1] sdp: a=‘x-dimensions:1280,720’
[rtsp @ 0xaddr1] sdp: a=‘control:rtsp://192.168.1.237:554/trackID=1’
[rtsp @ 0xaddr1] sdp: a=‘rtpmap:96 H264/90000’
[rtsp @ 0xaddr1] video codec set to: h264
[rtsp @ 0xaddr1] sdp: a=‘fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z01AH42NQCgC3/gLcBAQFAAAD6AAAnEDoYACZHAACsQy7y40MABMjgABWIZd5cKA,aO44gA==’
[rtsp @ 0xaddr1] RTP Profile IDC: 42 Profile IOP: 0 Level: 29
[rtsp @ 0xaddr1] RTP Packetization Mode: 1
[rtsp @ 0xaddr1] Extradata set to 0x7f8b16d01bd0 (size: 60)
[rtsp @ 0xaddr1] sdp: a=‘Media_header:MEDIAINFO=494D4B48010200000400000100000000000000000000000000000000000000000000000000000000;’
[rtsp @ 0xaddr1] sdp: a=‘appversion:1.0’
[rtp @ 0x7f8b16d01f00] No default whitelist set
[udp @ 0x7f8b16d01dc0] No default whitelist set
[udp @ 0x7f8b16d01dc0] end receive buffer size reported is 65536
[udp @ 0x7f8b16d01fc0] No default whitelist set
[udp @ 0x7f8b16d01fc0] end receive buffer size reported is 65536
[rtsp @ 0xaddr1] Sending:
SETUP rtsp://192.168.1.237:554/trackID=1 RTSP/1.0
Transport: RTP/AVP/UDP;unicast;client_port=13046-13047
CSeq: 4
User-Agent: Lavf58.12.100
Authorization: Digest username=“admin”, realm=“IP Camera(C1003)”, nonce=“d91c2ea9ccfdb9ec1cf3367d5a09d11a”, uri=“rtsp://192.168.1.237:554/trackID=1”, response=“c2ee577f307dac02d933bd20cc453763”


[rtsp @ 0xaddr1] line=‘RTSP/1.0 200 OK’
[rtsp @ 0xaddr1] line=‘CSeq: 4’
[rtsp @ 0xaddr1] line=‘Session: 80912336;timeout=60’
[rtsp @ 0xaddr1] line=‘Transport: RTP/AVP/UDP;unicast;client_port=13046-13047;server_port=8326-8327;ssrc=3a48d93e;mode=“play”’
[rtsp @ 0xaddr1] line=‘Date: Thu, Aug 02 2018 15:52:01 GMT’
[rtsp @ 0xaddr1] line=’’
[rtsp @ 0xaddr1] setting jitter buffer size to 500
[rtsp @ 0xaddr1] hello state=0
[rtsp @ 0xaddr1] Sending:
PLAY rtsp://192.168.1.237:554/ RTSP/1.0
Range: npt=0.000-
CSeq: 5
User-Agent: Lavf58.12.100
Session: 80912336
Authorization: Digest username=“admin”, realm=“IP Camera(C1003)”, nonce=“d91c2ea9ccfdb9ec1cf3367d5a09d11a”, uri=“rtsp://192.168.1.237:554/”, response=“d5422e0ca8d6e2eaf28c3079515007d8”


[rtsp @ 0xaddr1] line=‘RTSP/1.0 200 OK’
[rtsp @ 0xaddr1] line=‘CSeq: 5’
[rtsp @ 0xaddr1] line=‘Session: 80912336’
[rtsp @ 0xaddr1] line=‘RTP-Info: url=rtsp://192.168.1.237:554/trackID=1;seq=43674;rtptime=4016844952’
[rtsp @ 0xaddr1] line=‘Date: Thu, Aug 02 2018 15:52:01 GMT’
[rtsp @ 0xaddr1] line=’’
avformat_open_input(): Success erc: 0
[h264 @ 0xaddr2] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0xaddr2] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0xaddr2] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0xaddr2] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0xaddr2] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0xaddr2] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0xaddr2] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0xaddr2] Format yuvj420p chosen by get_format().
[h264 @ 0xaddr2] Reinit context to 1280x720, pix_fmt: yuvj420p
[rtsp @ 0xaddr2] max delay reached. need to consume packet
[rtsp @ 0xaddr2] RTP: missed 4 packets
[h264 @ 0xaddr2] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0xaddr2] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0xaddr2] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0xaddr2] left block unavailable for requested intra4x4 mode -1
[h264 @ 0xaddr2] error while decoding MB 0 41, bytestream 467
[h264 @ 0xaddr2] concealing 369 DC, 369 AC, 369 MV errors in I frame
[h264 @ 0xaddr2] nal_unit_type: 1, nal_ref_idc: 3
[h264 @ 0xaddr2] nal_unit_type: 1, nal_ref_idc: 3
[h264 @ 0xaddr2] nal_unit_type: 1, nal_ref_idc: 3
[h264 @ 0xaddr2] nal_unit_type: 1, nal_ref_idc: 3
[h264 @ 0xaddr2] nal_unit_type: 1, nal_ref_idc: 3
[rtsp @ 0xaddr2] All info found
[rtsp @ 0xaddr2] stream 0: start_time: 0.310 duration: -102481911520608.625
[rtsp @ 0xaddr2] format: start_time: 0.310 duration: -9223372036854.775 bitrate=0 kb/s
avformat_find_stream_info(): Success erc: 0
[rtsp @ 0xaddr2] Sending:
TEARDOWN rtsp://192.168.1.237:554/ RTSP/1.0
CSeq: 6
User-Agent: Lavf58.12.100
Session: 80912336
Authorization: Digest username=“admin”, realm=“IP Camera(C1003)”, nonce=“d91c2ea9ccfdb9ec1cf3367d5a09d11a”, uri=“rtsp://192.168.1.237:554/”, response=“f0346e1fd53b93175807925491cdb5cd”


cmd>