[FFmpeg-user] Is it possible to timeout a JPEG dump

Martijn van Beurden m_vanbeurden1 at hotmail.com
Wed May 22 15:14:38 EEST 2019


Hi all,

Currently I have a script running that dumps snapshots from a security camera MJPEG stream with this command

ffmpeg -i http://admin:admin@192.168.10.4/channel2 -c:v copy -f image2 -strftime 1 %Y-%m-%dT%H:%M:%S%z.jpg

However, in case the network has a dropout for some reason, the connection is broken but FFMPEG hangs. The process isn't stopped (apparently the broken connection is not detected) and there is no way of detecting this. Is there any way to set a timeout between frames arriving or something similar? Console output is this:

ffmpeg version N-93674-g1e01f66822 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
  configuration: --pkg-config-flags=--static --extra-cflags='-static -static-libstdc++ -static-libgcc -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --extra-ldflags='-static -static-libstdc++ -static-libgcc' --extra-libs='-lm -ldl -lpthread -lz -lrt' --enable-gpl --enable-nonfree --enable-libvorbis --enable-libtheora --enable-libvpx --enable-libopus
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 52.100 / 58. 52.100
  libavformat    58. 27.103 / 58. 27.103
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 49.100 /  7. 49.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, mpjpeg, from 'http://admin:admin@192.168.10.4/channel2':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Output #0, image2, to '/srv/camera/snapshots/zuidwest/%Y-%m-%dT%H:%M:%S%z.jpg':
  Metadata:
    encoder         : Lavf58.27.103
    Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[2.0K blob data]
[2.0K blob data]
[2.0K blob data]
[2.0K blob data]
[2.0K blob data]
[2.0K blob data]
[2.0K blob data]


More information about the ffmpeg-user mailing list