[FFmpeg-user] ffmpeg hanging indefinately if streaming connection dies

Andrew Wood andrewjameswood at ymail.com
Wed Aug 13 14:04:41 EEST 2025


On 13/08/2025 09:40, Rob Hallam wrote:
> On
> As Ferdi mentioned, sharing the full, uncut console output (without
> errors suppressed) from an instance where you have the problem will
> help others help you.
>
When it hangs it just stops at this:

ffmpeg -i rtsp://192.168.111.2:554 -acodec copy -vcodec copy -metadata 
title=MyVideo /root/video.mp4
ffmpeg version 5.1.6-0+deb12u1+rpt3 Copyright (c) 2000-2024 the FFmpeg 
developers
   built with gcc 12 (Debian 12.2.0-14)
   configuration: --prefix=/usr --extra-version=0+deb12u1+rpt3 
--toolchain=hardened --incdir=/usr/include/aarch64-linux-gnu 
--enable-gpl --disable-stripping --disable-mmal --enable-gnutls 
--enable-ladspa --enable-libaom --enable-libass --enable-libbluray 
--enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 
--enable-libdav1d --enable-libflite --enable-libfontconfig 
--enable-libfreetype --enable-libfribidi --enable-libglslang 
--enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame 
--enable-libmysofa --enable-libopenjpeg --enable-libopenmpt 
--enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist 
--enable-librubberband --enable-libshine --enable-libsnappy 
--enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh 
--enable-libsvtav1 --enable-libtheora --enable-libtwolame 
--enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp 
--enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg 
--enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx 
--enable-openal --enable-opencl --enable-opengl --enable-sand 
--enable-sdl2 --disable-sndio --enable-libjxl --enable-neon 
--enable-v4l2-request --enable-libudev --enable-epoxy 
--libdir=/usr/lib/aarch64-linux-gnu --arch=arm64 --enable-pocketsphinx 
--enable-librsvg --enable-libdc1394 --enable-libdrm --enable-vout-drm 
--enable-libiec61883 --enable-chromaprint --enable-frei0r 
--enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
   libavutil      57. 28.100 / 57. 28.100
   libavcodec     59. 37.100 / 59. 37.100
   libavformat    59. 27.100 / 59. 27.100
   libavdevice    59.  7.100 / 59.  7.100
   libavfilter     8. 44.100 /  8. 44.100
   libswscale      6.  7.100 /  6.  7.100
   libswresample   4.  7.100 /  4.  7.100
   libpostproc    56.  6.100 / 56.  6.100
Input #0, rtsp, from 'rtsp://192.168.111.2:554':
   Metadata:
     title           : Media Presentation
   Duration: N/A, start: 0.040111, bitrate: N/A
   Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 
1920x1080, 25 fps, 25 tbr, 90k tbn
File '/root/video.mp4' already exists. Overwrite? [y/N] y
Output #0, mp4, to '/root/video.mp4':
   Metadata:
     title           : MyVideo
     encoder         : Lavf59.27.100
   Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, 
bt709, progressive), 1920x1080, q=2-31, 25 fps, 25 tbr, 90k tbn
Stream mapping:
   Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x5555a7ea2970] 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
[mp4 @ 0x5555a7ea2970] 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.
[rtsp @ 0x5555a7e524b0] max delay reached. need to consume packet
[rtsp @ 0x5555a7e524b0] RTP: missed 410 packets
frame=  623 fps= 28 q=-1.0 size=    7424kB time=00:00:25.63 
bitrate=2372.0kbits/s speed=1.14x


This seems to affect every version from 4.4 onwards. Using 4.3 I get 
this (note the 'connection timed out') immediately followed by the 
process exiting:


  /usr/local/ffmpeg-4.3.2-arm64-static/ffmpeg -i 
rtsp://192.168.111.2:554 -acodec copy -vcodec copy -metadata 
title=MyVideo /root/video.mp4
ffmpeg version 4.3.2-static https://johnvansickle.com/ffmpeg/ Copyright 
(c) 2000-2021 the FFmpeg developers
   built with gcc 8 (Debian 8.3.0-6)
   configuration: --enable-gpl --enable-version3 --enable-static 
--disable-debug --disable-ffplay --disable-indev=sndio 
--disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r 
--enable-gnutls --enable-gmp --enable-libgme --enable-gray 
--enable-libaom --enable-libfribidi --enable-libass --enable-libfreetype 
--enable-libmp3lame --enable-libopencore-amrnb 
--enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband 
--enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis 
--enable-libopus --enable-libtheora --enable-libvidstab 
--enable-libvo-amrwbenc --enable-libvpx --enable-libwebp 
--enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d 
--enable-libxvid --enable-libzimg
   libavutil      56. 51.100 / 56. 51.100
   libavcodec     58. 91.100 / 58. 91.100
   libavformat    58. 45.100 / 58. 45.100
   libavdevice    58. 10.100 / 58. 10.100
   libavfilter     7. 85.100 /  7. 85.100
   libswscale      5.  7.100 /  5.  7.100
   libswresample   3.  7.100 /  3.  7.100
   libpostproc    55.  7.100 / 55.  7.100
Input #0, rtsp, from 'rtsp://192.168.111.2:554':
   Metadata:
     title           : Media Presentation
   Duration: N/A, start: 0.240000, bitrate: N/A
     Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 
1920x1080, 25 fps, 25 tbr, 90k tbn, 50 tbc
File '/root/video.mp4' already exists. Overwrite? [y/N] y
Output #0, mp4, to '/root/video.mp4':
   Metadata:
     title           : MyVideo
     encoder         : Lavf58.45.100
     Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, 
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
[mp4 @ 0xec1c150] Non-monotonous DTS in output stream 0:0; previous: 0, 
current: -17990; changing to 1. This may result in incorrect timestamps 
in the output file.
[mp4 @ 0xec1c150] Non-monotonous DTS in output stream 0:0; previous: 1, 
current: -14402; changing to 2. This may result in incorrect timestamps 
in the output file.
[mp4 @ 0xec1c150] Non-monotonous DTS in output stream 0:0; previous: 2, 
current: -10802; changing to 3. This may result in incorrect timestamps 
in the output file.
[mp4 @ 0xec1c150] Non-monotonous DTS in output stream 0:0; previous: 3, 
current: -7206; changing to 4. This may result in incorrect timestamps 
in the output file.
[mp4 @ 0xec1c150] Non-monotonous DTS in output stream 0:0; previous: 4, 
current: -3606; changing to 5. This may result in incorrect timestamps 
in the output file.
[mp4 @ 0xec1c150] Non-monotonous DTS in output stream 0:0; previous: 5, 
current: -2; changing to 6. This may result in incorrect timestamps in 
the output file.
[rtsp @ 0xebe9e20] max delay reached. need to consume packet
[rtsp @ 0xebe9e20] RTP: missed 152 packets
rtsp://192.168.111.2:554: Connection timed oute=00:00:07.75 
bitrate=2972.8kbits/s speed=1.36x
frame=  194 fps=7.4 q=-1.0 Lsize=    3026kB time=00:00:08.07 
bitrate=3068.1kbits/s speed=0.31x
video:3023kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB 
muxing overhead: 0.094321%





More information about the ffmpeg-user mailing list