[FFmpeg-user] timeout error when reading RTSP/RTP incoming audio stream

Yannick Barbeaux yannick.barbeaux at keemotion.com
Thu Jun 18 15:07:53 EEST 2020


On Mon, Jun 15, 2020 at 9:28 AM Yannick Barbeaux <
yannick.barbeaux at keemotion.com> wrote:

> Hello
> I am struggling to read a multicast audio RTP stream controlled by RTSP.
> As soon as I launch the ffplay or ffmpeg command, the RTP traffic starts
> (tcpdump) on port 5004/UDP (as advertised in the SDP file), so it should
> read the stream correctly but I finally get a time-out instead (and empty
> out file). The very same RTSP URL can be read without any issue with VLC or
> with rtpdump+sox.
>
> $ ffmpeg -y -rtsp_transport udp_multicast -i "rtsp://
> 192.168.2.148:554/by-name/AES67-stream (on hasseb-AoE-F8-82)" -vn -f
> s24le -ar 48000 -c:a pcm_s24be out.raw
> ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
>   built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
>   configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --disable-debug
> --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb
> --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb
> --enable-libpulse --enable-libfreetype --enable-gnutl
> s --enable-libdav1d --enable-libx264 --enable-libx265 --enable-libfdk-aac
> --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx
> --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr
> --enable-libxvid --enable-libvidstab --enable-libtheora --en
> able-libwavpack --enable-libopenjpeg --enable-libgsm --enable-nvenc
> --enable-libzimg --enable-libaom
>   libavutil      56. 31.100 / 56. 31.100
>   libavcodec     58. 54.100 / 58. 54.100
>   libavformat    58. 29.100 / 58. 29.100
>   libavdevice    58.  8.100 / 58.  8.100
>   libavfilter     7. 57.100 /  7. 57.100
>   libswscale      5.  5.100 /  5.  5.100
>   libswresample   3.  5.100 /  3.  5.100
>   libpostproc    55.  5.100 / 55.  5.100
> Guessed Channel Layout for Input Stream #0.0 : stereo
> Input #0, rtsp, from 'rtsp://192.168.2.148:554/by-name/AES67-stream (on
> hasseb-AoE-F8-82)':
> Metadata:
>     title           : AES67-stream (on hasseb-AoE-F8-82) streamed by
> "hasseb"
>   Duration: N/A, bitrate: 2304 kb/s
>     Stream #0:0: Audio: pcm_s24be, 48000 Hz, stereo, s32 (24 bit), 2304
> kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (pcm_s24be (native) -> pcm_s24be (native))
> Press [q] to stop, [?] for help
> rtsp://192.168.2.148:554/by-name/AES67-stream (on hasseb-AoE-F8-82):
> Connection timed out
> Output #0, s24le, to 'out.raw':
>   Metadata:
>     title           : AES67-stream (on hasseb-AoE-F8-82) streamed by
> "hasseb"
>     encoder         : Lavf58.29.100
>     Stream #0:0: Audio: pcm_s24be, 48000 Hz, stereo, s32 (24 bit), 2304
> kb/s
>     Metadata:
>       encoder         : Lavc58.54.100 pcm_s24be
> size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x
> video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: unknown
> Output file is empty, nothing was encoded (check -ss / -t / -frames
> parameters if used)
>
> The SDP file is :
>
> v=0
> o=- 254522267104 0 IN IP4 192.168.2.148
> s=AES67-stream (on hasseb-AoE-F8-82) streamed by "hasseb"
> t=0 0
> a=clock-domain:PTPv2 0
> a=recvonly
> m=audio 5004 RTP/AVP 98
> c=IN IP4 239.123.123.123/255
> a=rtpmap:98 L24/48000/2
> a=sync-time:0
> a=framecount:48
> a=source-filter: incl IN IP4 239.123.123.123 192.168.2.148
> a=ts-refclk:ptp=IEEE1588-2008:00-10-4b-ff-fe-2e-f8-82:domain-nmbr=0
> a=mediaclk:direct=0
> a=ptime:1
>
> Comparing those files, we see that ffmpeg detects the correct
> audio settings (pcm_s24be, 48000 Hz, stereo, s32 (24 bit)) so I cannot
> figure out why it can't read the data stream? I have tried to increase the
> timeout but that did not help.
>
> Any help would be appreciated. Thank you.
>
> Yannick
>

More info on this:
the tcpdump on rtsp traffic is : (successively OPTIONS, DESCRIBE, SETUP,
PLAY and TEARDOWN, a somehow standard communication. Yet, most of the time,
SETUP and PLAY are missing) :

 sudo tcpdump -n -i ens4f3 port 554
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens4f3, link-type EN10MB (Ethernet), capture size 262144 bytes
13:59:58.356690 IP 10.1.4.1.51262 > 10.1.4.13.554: Flags [S], seq
2723630532, win 65216, options [mss 8152,sackOK,TS val 1086134674 ecr
0,nop,wscale 8], length 0
13:59:58.356889 IP 10.1.4.13.554 > 10.1.4.1.51262: Flags [S.], seq 1012959,
ack 2723630533, win 5840, options [mss 1460,nop,wscale 0], length 0
13:59:58.356918 IP 10.1.4.1.51262 > 10.1.4.13.554: Flags [.], ack 1, win
255, length 0
13:59:58.357008 IP 10.1.4.1.51262 > 10.1.4.13.554: Flags [P.], seq 1:125,
ack 1, win 255, length 124: RTSP: OPTIONS rtsp://
10.1.4.13:554/by-name/AES67-stream%20(on%20hasseb-AoE-F8-82) RTSP/1.0
13:59:58.357488 IP 10.1.4.13.554 > 10.1.4.1.51262: Flags [P.], seq 1:70,
ack 125, win 5716, length 69: RTSP: RTSP/1.0 200 OK
13:59:58.357509 IP 10.1.4.1.51262 > 10.1.4.13.554: Flags [.], ack 70, win
255, length 0
13:59:58.357700 IP 10.1.4.1.51262 > 10.1.4.13.554: Flags [P.], seq 125:275,
ack 70, win 255, length 150: RTSP: DESCRIBE rtsp://
10.1.4.13:554/by-name/AES67-stream%20(on%20hasseb-AoE-F8-82) RTSP/1.0
13:59:58.359469 IP 10.1.4.13.554 > 10.1.4.1.51262: Flags [P.], seq 70:678,
ack 275, win 5566, length 608: RTSP: RTSP/1.0 200 OK
13:59:58.360238 IP 10.1.4.1.51262 > 10.1.4.13.554: Flags [P.], seq 275:428,
ack 678, win 253, length 153: RTSP: SETUP rtsp://
10.1.4.13:554/by-name/AES67-stream (on hasseb-AoE-F8-82)/ RTSP/1.0
13:59:58.361279 IP 10.1.4.13.554 > 10.1.4.1.51262: Flags [P.], seq 678:844,
ack 428, win 5413, length 166: RTSP: RTSP/1.0 200 OK
13:59:58.362281 IP 10.1.4.1.51262 > 10.1.4.13.554: Flags [P.], seq 428:588,
ack 844, win 253, length 160: RTSP: PLAY rtsp://
10.1.4.13:554/by-name/AES67-stream (on hasseb-AoE-F8-82)/ RTSP/1.0
13:59:58.362851 IP 10.1.4.13.554 > 10.1.4.1.51262: Flags [P.], seq 844:914,
ack 588, win 5253, length 70: RTSP: RTSP/1.0 200 OK
13:59:58.406694 IP 10.1.4.1.51262 > 10.1.4.13.554: Flags [.], ack 914, win
253, length 0
14:00:18.493638 IP 10.1.4.1.51262 > 10.1.4.13.554: Flags [P.], seq 588:733,
ack 914, win 253, length 145: RTSP: TEARDOWN rtsp://
10.1.4.13:554/by-name/AES67-stream (on hasseb-AoE-F8-82)/ RTSP/1.0
14:00:18.493711 IP 10.1.4.1.51262 > 10.1.4.13.554: Flags [F.], seq 733, ack
914, win 253, length 0
14:00:18.494126 IP 10.1.4.13.554 > 10.1.4.1.51262: Flags [P.], seq 914:942,
ack 733, win 5108, length 28: RTSP: RTSP/1.0 200 OK
14:00:18.494180 IP 10.1.4.1.51262 > 10.1.4.13.554: Flags [R], seq
2723631265, win 0, length 0
14:00:18.494397 IP 10.1.4.13.554 > 10.1.4.1.51262: Flags [F.], seq 942, ack
734, win 5107, length 0
14:00:18.494414 IP 10.1.4.1.51262 > 10.1.4.13.554: Flags [R], seq
2723631266, win 0, length 0

and the ffmpeg output in debug mode:

$ ffmpeg -loglevel debug -y -re -rtsp_transport udp_multicast -i "rtsp://
10.1.4.13:554/by-name/AES67-stream%20(on%20hasseb-AoE-F8-82)" -vn -f s24le
-ar 48000 -ar 2 -b:a 2304000 -c:a pcm_s24be out.raw
ffmpeg version n4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/home/vagrant/ffmpeg_latest/build
--pkg-config-flags=--static --extra-cflags='
-I/home/vagrant/ffmpeg_latest/build/include'
--extra-ldflags=-L/home/vagrant/ffmpeg_latest/build/lib
--bindir=/home/vagrant/ffmpeg_latest/build/bin --enable-gpl --enable-
libass --enable-libsrt --enable-libfdk-aac --enable-libfreetype
--enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-nvenc
--enable-libxvid --enable-nonfree --enable-libx264 --enable-static
--enable-decklink --enable-pic --disable-shared --enable-openssl
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with
argument '1'.
Reading option '-re' ... matched as option 're' (read input at native frame
rate) with argument '1'.
Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport'
with argument 'udp_multicast'.
Reading option '-i' ... matched as input url with argument 'rtsp://
10.1.4.13:554/by-name/AES67-stream%20(on%20hasseb-AoE-F8-82)'.
Reading option '-vn' ... matched as option 'vn' (disable video) with
argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument
's24le'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate
(in Hz)) with argument '48000'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate
(in Hz)) with argument '2'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use
-b:v)) with argument '2304000'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument
'pcm_s24be'.
Reading option 'out.raw' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url rtsp://
10.1.4.13:554/by-name/AES67-stream%20(on%20hasseb-AoE-F8-82).
Applying option re (read input at native frame rate) with argument 1.
Successfully parsed a group of options.
Opening an input file: rtsp://
10.1.4.13:554/by-name/AES67-stream%20(on%20hasseb-AoE-F8-82).
[tcp @ 0x558be9740480] No default whitelist set
[tcp @ 0x558be9740480] Original list of addresses:
[tcp @ 0x558be9740480] Address 10.1.4.13 port 554
[tcp @ 0x558be9740480] Interleaved list of addresses:
[tcp @ 0x558be9740480] Address 10.1.4.13 port 554
[tcp @ 0x558be9740480] Starting connection attempt to 10.1.4.13 port 554
[tcp @ 0x558be9740480] Successfully connected to 10.1.4.13 port 554
[rtsp @ 0x558be973e0c0] SDP:
v=0
o=- 251189410444 0 IN IP4 10.1.4.13
s=AES67-stream (on hasseb-AoE-F8-82) streamed by "hasseb"
t=0 0
a=clock-domain:PTPv2 0
a=recvonly
m=audio 5004 RTP/AVP 98
c=IN IP4 239.49.113.243/255
a=rtpmap:98 L24/48000/2
a=sync-time:0
a=framecount:48
a=source-filter: incl IN IP4 239.49.113.243 10.1.4.13
a=ts-refclk:ptp=IEEE1588-2008:00-10-4b-ff-fe-2e-f8-82:domain-nmbr=0
a=mediaclk:direct=0
a=ptime:1
[rtsp @ 0x558be973e0c0] audio codec set to: pcm_s24be
[rtsp @ 0x558be973e0c0] audio samplerate set to: 48000
[rtsp @ 0x558be973e0c0] audio channels set to: 2
[rtp @ 0x558be9741e40] No default whitelist set
[udp @ 0x558be9742500] No default whitelist set
[udp @ 0x558be9742500] end receive buffer size reported is 131072
[udp @ 0x558be9752bc0] No default whitelist set
[udp @ 0x558be9752bc0] end receive buffer size reported is 131072
[rtsp @ 0x558be973e0c0] setting jitter buffer size to 500
[rtsp @ 0x558be973e0c0] hello state=0
Failed to parse interval end specification ''
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, rtsp, from 'rtsp://
10.1.4.13:554/by-name/AES67-stream%20(on%20hasseb-AoE-F8-82)':
  Metadata:
    title           : AES67-stream (on hasseb-AoE-F8-82) streamed by
"hasseb"
  Duration: N/A, bitrate: 2304 kb/s
    Stream #0:0, 0, 1/48000: Audio: pcm_s24be, 48000 Hz, stereo, s32 (24
bit), 2304 kb/s
Successfully opened the file.
Parsing a group of options: output url out.raw.
Applying option vn (disable video) with argument 1.
Applying option f (force format) with argument s24le.
Applying option ar (set audio sampling rate (in Hz)) with argument 48000.
Applying option ar (set audio sampling rate (in Hz)) with argument 2.
Applying option b:a (video bitrate (please use -b:v)) with argument 2304000.
Applying option c:a (codec name) with argument pcm_s24be.
Successfully parsed a group of options.
Opening an output file: out.raw.
[file @ 0x558be977b400] Setting default whitelist 'file,crypto'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s24be (native) -> pcm_s24be (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
rtsp://10.1.4.13:554/by-name/AES67-stream%20(on%20hasseb-AoE-F8-82):
Connection timed out
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
detected 24 logical cores
[graph_0_in_0_0 @ 0x558be977fe40] Setting 'time_base' to value '1/48000'
[graph_0_in_0_0 @ 0x558be977fe40] Setting 'sample_rate' to value '48000'
[graph_0_in_0_0 @ 0x558be977fe40] Setting 'sample_fmt' to value 's32'
[graph_0_in_0_0 @ 0x558be977fe40] Setting 'channel_layout' to value '0x3'
[graph_0_in_0_0 @ 0x558be977fe40] tb:1/48000 samplefmt:s32 samplerate:48000
chlayout:0x3
[format_out_0_0 @ 0x558be97802c0] Setting 'sample_fmts' to value 's32'
[format_out_0_0 @ 0x558be97802c0] Setting 'sample_rates' to value '2'
[auto_resampler_0 @ 0x558be9782a80] Setting 'output_sample_bits' to value
'24'
[format_out_0_0 @ 0x558be97802c0] auto-inserting filter 'auto_resampler_0'
between the filter 'Parsed_anull_0' and the filter 'format_out_0_0'
[AVFilterGraph @ 0x558be977cf00] query_formats: 4 queried, 6 merged, 3
already done, 0 delayed
[auto_resampler_0 @ 0x558be9782a80] [SWR @ 0x558be9782d80] Using fltp
internally between filters
[auto_resampler_0 @ 0x558be9782a80] ch:2 chl:stereo fmt:s32 r:48000Hz ->
ch:2 chl:stereo fmt:s32 r:2Hz
The bitrate parameter is set too low. It takes bits/s as argument, not
kbits/s
Output #0, s24le, to 'out.raw':
  Metadata:
    title           : AES67-stream (on hasseb-AoE-F8-82) streamed by
"hasseb"
    encoder         : Lavf58.20.100
    Stream #0:0, 0, 1/2: Audio: pcm_s24be, 2 Hz, stereo, s32 (24 bit), 0
kb/s
    Metadata:
      encoder         : Lavc58.35.100 pcm_s24be
[out_0_0 @ 0x558be9780c80] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.peed=   0x
size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
Input file #0 (rtsp://
10.1.4.13:554/by-name/AES67-stream%20(on%20hasseb-AoE-F8-82)):
  Input stream #0:0 (audio): 0 packets read (0 bytes); 0 frames decoded (0
samples);
  Total: 0 packets (0 bytes) demuxed
Output file #0 (out.raw):
  Output stream #0:0 (audio): 0 frames encoded (0 samples); 0 packets muxed
(0 bytes);
  Total: 0 packets (0 bytes) muxed
Output file is empty, nothing was encoded (check -ss / -t / -frames
parameters if used)
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x558be977b740] Statistics: 0 seeks, 0 writeouts

Thanks

Yannick


More information about the ffmpeg-user mailing list