[FFmpeg-user] ffmpeg stops after empty JPG

Martijn van Beurden m_vanbeurden1 at hotmail.com
Fri May 3 21:57:22 EEST 2019


Hi all,

ffmpeg apparently stops encoding without warning when it encounters an empty JPG file. I have a script dumping camera snapshots every second, which I want to convert to a video. However, sometimes, an empty snapshot is returned.

Command (cron job): ffmpeg  -pattern_type glob -framerate 5 -i "/srv/camera/snapshots/noordoost/`date -d '1 hour ago' +%Y-%m-%dT%H:*%z`.jpg" -vf scale=1280:-1 -c:v mpeg4 -q:v 4 /srv/camera/noordoost-jpeg-`date -d '95 minutes ago' -Isec`.mts

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, image2, from '/srv/camera/snapshots/noordoost/2019-05-03T18:*+0200.jpg':
  Duration: 00:11:52.80, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 5 fps, 5 tbr, 5 tbn, 5 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
[swscaler @ 0x3f88f80] deprecated pixel format used, make sure you did set range correctly
Output #0, mpegts, to '/srv/camera/noordoost-jpeg-2019-05-03T18:00:01+02:00.mts':
  Metadata:
    encoder         : Lavf58.27.103
    Stream #0:0: Video: mpeg4, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 5 fps, 90k tbn, 5 tbc
    Metadata:
      encoder         : Lavc58.52.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame=   13 fps=0.0 q=4.0 size=     768kB time=00:00:02.40 bitrate=2621.4kbits/s speed=4.63x
frame=   30 fps= 29 q=4.0 size=    1536kB time=00:00:05.80 bitrate=2169.5kbits/s speed=5.59x
frame=   42 fps= 27 q=4.0 size=    2304kB time=00:00:08.20 bitrate=2301.7kbits/s speed=5.24x
frame=   57 fps= 27 q=4.0 size=    2816kB time=00:00:11.20 bitrate=2059.7kbits/s speed=5.39x
frame=   73 fps= 28 q=4.0 size=    3840kB time=00:00:14.40 bitrate=2184.5kbits/s speed=5.55x
frame=   88 fps= 28 q=4.0 size=    4608kB time=00:00:17.40 bitrate=2169.5kbits/s speed=5.61x
frame=  104 fps= 29 q=4.0 size=    5376kB time=00:00:20.60 bitrate=2137.9kbits/s speed=5.68x
frame=  119 fps= 29 q=4.0 size=    6144kB time=00:00:23.60 bitrate=2132.7kbits/s speed=5.69x
frame=  133 fps= 29 q=4.0 Lsize=    7233kB time=00:00:26.40 bitrate=2244.4kbits/s speed=5.77x
video:6693kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.061441%


Is there a way to remedy this, except running a bash script to remove all empty files first?

Kind regards,

Martijn van Beurden


More information about the ffmpeg-user mailing list