1

I'm trying to decode a video into its frames with the following code:

`

Decode the video into 30 fps frames with ffmpeg

  check_call(['ffmpeg', '-i', 'file:'+clip_name+'.mp4', '-vf', 'fps=30', 'frame_%06d.jpg'])

  # Create a directory for this clip
  check_call(['mkdir', '-p', clip_out_dir])

  # Move the results to the output directory
  for jpg in glob.glob('*.jpg'):
    check_call(['mv', jpg, clip_out_dir])`

However, it is not working. How can I fix this? This is the output I get:

ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.2.0 (GCC)
  configuration: --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --disable-debug --disable-doc --disable-static --enable-optimizations --enable-shared --disable-everything --enable-ffplay --enable-ffprobe --enable-gnutls --enable-libaom --enable-libdav1d --enable-libfdk-aac --enable-libmp3lame --enable-libfontconfig --enable-libfreetype --enable-libopus --enable-libpulse --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-openal --enable-opengl --enable-sdl2 --enable-vulkan --enable-zlib --enable-libv4l2 --enable-libxcb --enable-vdpau --enable-vaapi --enable-encoder='ac3,alac,flac,libfdk_aac,g723_1,mp2,libmp3lame,libopus,libspeex,pcm_alaw,pcm_mulaw,pcm_f32le,pcm_s16be,pcm_s24be,pcm_s16le,pcm_s24le,pcm_s32le,pcm_u8,tta,libvorbis,wavpack,' --enable-encoder='ass,ffv1,libaom_av1,libvpx_vp8,libvpx_vp9,mjpeg_vaapi,rawvideo,theora,vp8_vaapi,libopenh264' --enable-decoder='adpcm_g722ac3,alac,flac,g723_1,g729,libfdk_aac,libopus,libspeex,mp2,mp3,m4a,pcm_alaw,pcm_mulaw,pcm_f16le,pcm_f24le,pcm_f32be,pcm_f32le,pcm_f64be,pcm_f64le,pcm_s16be,pcm_s16be_planar,pcm_s24be,pcm_s16le,pcm_s16le_planar,pcm_s24le,pcm_s24le_planar,pcm_s32le,pcm_s32le_planar,pcm_s64be,pcm_s64le,pcm_s8,pcm_s8_planar,pcm_u8,pcm_u24be,pcm_u24le,pcm_u32be,pcm_u32be,tta,vorbis,wavpack,' --enable-decoder='ass,ffv1,mjpeg,mjpegb,libaom_av1,libdav1d,libvpx_vp8,libvpx_vp9,rawvideo,theora,vp8,vp9,libopenh264' --enable-encoder='bmp,gif,jpegls,png,tiff,webp,' --enable-decoder='bmp,gif,jpegls,png,tiff,webp,' --enable-hwaccel='vp8_vaapi,mjpeg_vaapi,' --enable-parser='aac,ac3,flac,mjpeg,mpegaudio,mpeg4video,opus,vp3,vp8,vp9,vorbis,' --enable-muxer='ac3,ass,flac,g722,gif,matroska,mp3,mpegvideo,rtp,ogg,opus,pcm_s16be,pcm_s16le,wav,webm,' --enable-demuxer='aac,ac3,ass,flac,g722,gif,image_jpeg_pipe,image_png_pipe,image_webp_pipe,matroska,mjpeg,mov,mp3,mpegvideo,ogg,pcm_mulaw,pcm_alaw,pcm_s16be,pcm_s16le,rtp,wav,' --enable-filter='crop,scale,overlay,amix,amerge,aresample,format,aformat,fps,transpose,pad,' --enable-protocol='crypto,file,pipe,rtp,srtp,rtsp,tcp,udp,unix,' --arch=x86_64 --enable-libopenh264

  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

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:/home/emely/Data/yt_bb_videos/yt_bb_detection_validation/vcALsxetYU4_temp.mp4':

  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2009-06-04T17:08:04.000000Z
  Duration: 00:10:00.44, start: 0.000000, bitrate: 451 kb/s
    Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 125 kb/s (default)

    Metadata:
      creation_time   : 2009-06-04T17:08:04.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
    Stream #0:1(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 384x288, 323 kb/s, 25 fps, 25 tbr, 24998 tbn, 24998 tbc (default)

    Metadata:
      creation_time   : 2009-06-04T17:08:04.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.

[NULL @ 0x5634538337c0] Unable to find a suitable output format for 'frame_%06d.jpg'
frame_%06d.jpg: Invalid argument

Traceback (most recent call last):
  File "decode.py", line 84, in <module>
    decode(*sys.argv[1:])
  File "decode.py", line 70, in decode
    check_call(['ffmpeg', '-i', 'file:'+clip_name+'.mp4', '-vf', 'fps=30', 'frame_%06d.jpg'])
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ffmpeg', '-i', 'file:/home/emely/Data/yt_bb_videos/yt_bb_detection_validation/vcALsxetYU4_temp.mp4', '-vf', 'fps=30', 'frame_%06d.jpg']' returned non-zero exit status 1. ```


Thx in advance!
  • 1
    It should work (works for me), I'm wondering if the % in the file name needs escaping..? – stib Sep 29 at 9:46
1

Your build doesn't have the image2 muxer enabled, which is required for image sequences.

| improve this answer | |
  • How do I enable the image2 muxer? Thanks so much! – Emely Sep 30 at 10:11
  • Get a precompiled git master binary from johnvansickle.com/ffmpeg or you'll have to compile it yourself. – Gyan Sep 30 at 11:16

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.