0

I must be doing something obviously wrong but cannot see it.

The set up is a hardware video encoder providing multiple streams. A similar video decoder receives the RTSP stream as does VLC.

So does ffmpeg, it can see the stream and how the stream is configured by RTSP. But then it times out.

Here is one test & verbose output

ffmpeg  -y -loglevel debug  -rtsp_transport udp -stimeout 10000000  -i rtsp://192.168.2.82/1 -acodec copy -vcodec copy test.mp4
ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.8)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include/darwin -fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  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
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'udp'.
Reading option '-stimeout' ... matched as AVOption 'stimeout' with argument '10000000'.
Reading option '-i' ... matched as input url with argument 'rtsp://192.168.2.82/1'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'copy'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'copy'.
Reading option 'test.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url rtsp://192.168.2.82/1.
Successfully parsed a group of options.
Opening an input file: rtsp://192.168.2.82/1.
[tcp @ 0x7fbbba521940] No default whitelist set
[tcp @ 0x7fbbba521940] Original list of addresses:
[tcp @ 0x7fbbba521940] Address 192.168.2.82 port 554
[tcp @ 0x7fbbba521940] Interleaved list of addresses:
[tcp @ 0x7fbbba521940] Address 192.168.2.82 port 554
[tcp @ 0x7fbbba521940] Starting connection attempt to 192.168.2.82 port 554
[tcp @ 0x7fbbba521940] Successfully connected to 192.168.2.82 port 554
[rtsp @ 0x7fbbbb00ba00] SDP:
v=0
o=- 18467 41 IN IP4 0.0.0.0
s=Unnamed
i=N/A
c=IN IP4 0.0.0.0
t=0 0
a=control:*
a=range:npt=0-
m=video 0 RTP/AVP 96
a=rtpmap:96 H265/90000
a=fmtp:96 sprop-vps=QAEMAf//AWAAAAMAsAAAAwAAAwBarAwAAAMABAAAAwB6qA==; sprop-sps=QgEBAWAAAAMAsAAAAwAAAwBaoAWCAJBY2uSTL83AQEBBAAADAAEAAAMAHqE=; sprop-pps=RAHA8vA8kA==
a=control:track1
m=audio 0 RTP/AVP 97
a=rtpmap:97 MPEG4-GENERIC/44100/2
a=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=1210
a=control:track2


Failed to parse interval end specification ''
[rtsp @ 0x7fbbbb00ba00] video codec set to: hevc
[rtsp @ 0x7fbbbb00ba00] audio codec set to: aac
[rtsp @ 0x7fbbbb00ba00] audio samplerate set to: 44100
[rtsp @ 0x7fbbbb00ba00] audio channels set to: 2
[rtp @ 0x7fbbba404780] No default whitelist set
[udp @ 0x7fbbba40a0c0] No default whitelist set
[udp @ 0x7fbbba40a0c0] end receive buffer size reported is 65536
[udp @ 0x7fbbba403180] No default whitelist set
[udp @ 0x7fbbba403180] end receive buffer size reported is 65536
[rtsp @ 0x7fbbbb00ba00] setting jitter buffer size to 500
[rtp @ 0x7fbbba403f00] No default whitelist set
[udp @ 0x7fbbba404200] No default whitelist set
[udp @ 0x7fbbba404200] end receive buffer size reported is 65536
[udp @ 0x7fbbba4042c0] No default whitelist set
[udp @ 0x7fbbba4042c0] end receive buffer size reported is 65536
[rtsp @ 0x7fbbbb00ba00] setting jitter buffer size to 500
[rtsp @ 0x7fbbbb00ba00] hello state=0
[hevc @ 0x7fbbbb00da00] nal_unit_type: 32(VPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x7fbbbb00da00] nal_unit_type: 33(SPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x7fbbbb00da00] nal_unit_type: 34(PPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x7fbbbb00da00] Decoding VPS
[hevc @ 0x7fbbbb00da00] Main profile bitstream
[hevc @ 0x7fbbbb00da00] Decoding SPS
[hevc @ 0x7fbbbb00da00] Main profile bitstream
[hevc @ 0x7fbbbb00da00] Decoding VUI
[hevc @ 0x7fbbbb00da00] Decoding PPS
[hevc @ 0x7fbbbb00da00] nal_unit_type: 32(VPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x7fbbbb00da00] nal_unit_type: 33(SPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x7fbbbb00da00] nal_unit_type: 34(PPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 0x7fbbbb00da00] Decoding VPS
[hevc @ 0x7fbbbb00da00] Main profile bitstream
[hevc @ 0x7fbbbb00da00] Decoding SPS
[hevc @ 0x7fbbbb00da00] Main profile bitstream
[hevc @ 0x7fbbbb00da00] Decoding VUI
[hevc @ 0x7fbbbb00da00] Decoding PPS
Input #0, rtsp, from 'rtsp://192.168.2.82/1':
  Metadata:
    title           : Unnamed
    comment         : N/A
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0, 0, 1/90000: Video: hevc (Main), 1 reference frame, yuvj420p(pc, bt709), 704x576, 0/1, 30 tbr, 90k tbn, 30 tbc
    Stream #0:1, 0, 1/44100: Audio: aac, 44100 Hz, stereo, fltp
Successfully opened the file.
Parsing a group of options: output url test.mp4.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument copy.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument copy.
Successfully parsed a group of options.
Opening an output file: test.mp4.
[file @ 0x7fbbba529880] Setting default whitelist 'file,crypto'
Successfully opened the file.
[mp4 @ 0x7fbbbb01de00] track 1: codec frame size is not set
Output #0, mp4, to 'test.mp4':
  Metadata:
    title           : Unnamed
    comment         : N/A
    encoder         : Lavf58.29.100
    Stream #0:0, 0, 1/90000: Video: hevc (Main), 1 reference frame (hev1 / 0x31766568), yuvj420p(pc, bt709), 704x576 (0x0), 0/1, q=2-31, 30 tbr, 90k tbn, 90k tbc
    Stream #0:1, 0, 1/44100: Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:1 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
rtsp://192.168.2.82/1: Operation timed out
No more output streams to write to, finishing.
frame=    0 fps=0.0 q=-1.0 Lsize=       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://192.168.2.82/1):
  Input stream #0:0 (video): 0 packets read (0 bytes); 
  Input stream #0:1 (audio): 0 packets read (0 bytes); 
  Total: 0 packets (0 bytes) demuxed
Output file #0 (test.mp4):
  Output stream #0:0 (video): 0 packets muxed (0 bytes); 
  Output stream #0:1 (audio): 0 packets muxed (0 bytes); 
  Total: 0 packets (0 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x7fbbba40af40] Statistics: 2 seeks, 3 writeouts

Everything looks good, I can adjust params on the encoder, and ffmpeg sees them and in spite of various command line params, always a timeout.

Encoder, decoder, laptop, vlc all on same wlan. Surprising everything but ffmpeg can receive. No doubt through my lack of understanding of ffmpeg and rtsp, I'm missing something. Any help appreciated!

0

Figured it out, so wanted to leave an answer on it.

The encoder was not using UDP after all. And so -rtsp_transport udp would timeout since it was not available. My red herring was observing ffmpeg obtain the SDP data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.