Opened 6 years ago
Last modified 4 years ago
#7609 reopened defect
rw_timeout dont work in RTSP
Reported by: | jidckii | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avformat |
Version: | unspecified | Keywords: | rtsp |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
The rw_timeout option does not work with the rtsp protocol
ffmpeg version:
ffprobe version 4.1 Copyright (c) 2007-2018 the FFmpeg developers built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516 configuration: --arch=amd64 --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-libkvazaar --enable-postproc --enable-small --enable-version3 --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --extra-libs=-ldl --prefix=/usr/local 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 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 3.100 / 5. 3.100 libswresample 3. 3.100 / 3. 3.100 libpostproc 55. 3.100 / 55. 3.100
playback example:
# ffprobe -rw_timeout 20000000 http://example.com/hls/camera1.m3u8 [hls,applehttp @ 0x559fd994b640] Opening 'http://example.com/hls/camera1-1544594784.ts' for reading [hls,applehttp @ 0x559fd994b640] Opening 'http://example.com/hls/camera1-1544594787.ts' for reading Input #0, hls,applehttp, from 'http://example.com/hls/camera1.m3u8': Duration: N/A, start: 41406.580044, bitrate: N/A Program 0 Metadata: variant_bitrate : 0 Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuvj420p(pc, bt709), 1920x1080, 25 fps, 25 tbr, 90k tbn, 180k tbc Metadata: variant_bitrate : 0 ffprobe -rw_timeout 20000000 rtmp://camera3_restreamer/live/camera3 Input #0, flv, from 'rtmp://camera3_restreamer/live/camera3': Metadata: encoder : Lavf58.20.100 Duration: N/A, start: 1122798.806000, bitrate: N/A Stream #0:0: Subtitle: text Stream #0:1: Video: h264, yuvj420p(pc, bt709, progressive), 1920x1080, 23.67 fps, 23.67 tbr, 1k tbn # ffprobe -rw_timeout 20000000 rtsp://192.168.0.101 Option rw_timeout not found.
Change History (6)
follow-up: 2 comment:1 by , 6 years ago
Component: | avutil → undetermined |
---|---|
Keywords: | rw_timeout removed |
Priority: | critical → normal |
comment:2 by , 6 years ago
Replying to cehoyos:
Please test current FFmpeg git head and please do not test
ffprobe
if the issue is also reproducible withffmpeg
and provide the command line you tested together with the complete, uncut console output.
Okay )
Here is an example from the last snapshot and using ffmpeg:
# ffmpeg -version ffmpeg version N-92677-gdd7d603 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516 configuration: --arch=amd64 --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-libkvazaar --enable-postproc --enable-small --enable-version3 --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --extra-libs=-ldl --prefix=/usr/local libavutil 56. 24.101 / 56. 24.101 libavcodec 58. 42.100 / 58. 42.100 libavformat 58. 24.100 / 58. 24.100 libavdevice 58. 6.101 / 58. 6.101 libavfilter 7. 46.101 / 7. 46.101 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 4.100 / 5. 4.100 libswresample 3. 4.100 / 3. 4.100 libpostproc 55. 4.100 / 55. 4.100 # ffmpeg -rw_timeout 20000000 -rtsp_transport tcp -i rtsp://192.168.0.121 -c copy -f mpegts udp://127.0.0.1:1234 Option rw_timeout not found. # ffmpeg -rtsp_transport tcp -i rtsp://192.168.0.121 -c copy -f mpegts udp://127.0.0.1:1234 Input #0, rtsp, from 'rtsp://192.168.0.121': Metadata: title : Duration: N/A, start: 0.040000, bitrate: N/A Stream #0:0: Video: h264, yuvj420p(pc, bt709, progressive), 1920x1080, 25 fps, 25 tbr, 90k tbn, 180k tbc Output #0, mpegts, to 'udp://127.0.0.1:1234': Metadata: title : encoder : Lavf58.24.100 Stream #0:0: Video: h264, yuvj420p(pc, bt709, progressive), 1920x1080, q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help [mpegts @ 0x555c168340c0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly [mpegts @ 0x555c168340c0] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file. frame= 90 fps= 36 q=-1.0 Lsize= 1029kB time=00:00:04.36 bitrate=1933.5kbits/s speed=1.75x video:944kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.984775% Exiting normally, received signal 2. # ffmpeg -rw_timeout 20000000 -i http://example.org/hls/cam2.m3u8 -c copy -f mpegts udp://127.0.0.1:1234 [hls,applehttp @ 0x55f27d002340] Opening 'http://example.org/hls/cam2-1544608827.ts' for reading [hls,applehttp @ 0x55f27d002340] Opening 'http://example.org/hls/cam2-1544608830.ts' for reading Input #0, hls,applehttp, from 'http://example.org/hls/cam2.m3u8': Duration: N/A, start: 55449.860044, bitrate: N/A Program 0 Metadata: variant_bitrate : 0 Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuvj420p(pc, bt709), 1920x1080, 25 fps, 25 tbr, 90k tbn, 180k tbc Metadata: variant_bitrate : 0 Output #0, mpegts, to 'udp://127.0.0.1:1234': Metadata: encoder : Lavf58.24.100 Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuvj420p(pc, bt709), 1920x1080, q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc Metadata: variant_bitrate : 0 Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help [http @ 0x55f27d00a200] Opening 'http://example.org/hls/cam2-1544608833.ts' for reading [http @ 0x55f27d00a200] Opening 'http://example.org/hls/cam2-1544608836.ts' for reading [http @ 0x55f27d07e4c0] Opening 'http://example.org/hls/cam2.m3u8' for reading [http @ 0x55f27d00a200] Opening 'http://example.org/hls/cam2-1544608839.ts' for reading ^Came= 300 fps= 50 q=-1.0 size= 3091kB time=00:00:11.96 bitrate=2117.3kbits/s speed=2.01x
comment:4 by , 5 years ago
Resolution: | → needs_more_info |
---|---|
Status: | new → closed |
comment:5 by , 5 years ago
Resolution: | needs_more_info |
---|---|
Status: | closed → reopened |
This behavior is contrary to the documentation section:
http://ffmpeg.org/ffmpeg-all.html#Protocols
All protocols accept the following options: rw_timeout Maximum time to wait for (network) read/write operations to complete, in microseconds.
Need to make a remark about RTSP, or fix bug.
comment:6 by , 4 years ago
Component: | undetermined → avformat |
---|
I was having the same issue. RTSP has its own timeout handling, not sure how it interacts with rw_timeout. I "fixed" my RTSP by modifying the define:
/* Timeout values for socket poll, in ms,
- and read_packet(), in seconds */
#define POLL_TIMEOUT_MS 100
#define READ_PACKET_TIMEOUT_S 10
#define MAX_TIMEOUTS READ_PACKET_TIMEOUT_S * 1000 / POLL_TIMEOUT_MS
The math in the code is off somehow since the timeout is actually 2 times the READ_PACKET_TIMEOUT_S. I didn't dig any further.
Please test current FFmpeg git head and please do not test
ffprobe
if the issue is also reproducible withffmpeg
and provide the command line you tested together with the complete, uncut console output.