Warum gibt FFMPEG Frames nicht als JPG aus? Wie kann ich meinen Code reparieren?

Ich versuche, ein Video mit dem folgenden Code in seine Frames zu decodieren:

`

Decodieren Sie das Video mit ffmpeg in 30-fps-Frames

  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])`

Es funktioniert jedoch nicht. Wie kann ich das beheben? Dies ist die Ausgabe, die ich bekomme:

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!
Es sollte funktionieren (funktioniert für mich), ich frage mich, ob das % im Dateinamen maskiert werden muss.

Antworten (1)

Ihr Build hat keinen image2Muxer aktiviert, der für Bildsequenzen erforderlich ist.

Wie aktiviere ich den Image2-Muxer? Vielen Dank!
Holen Sie sich eine vorkompilierte Git-Master-Binärdatei von johnvansickle.com/ffmpeg oder Sie müssen sie selbst kompilieren.