在 Python 中使用 FFmpeg 进行帧提取

在 Python 中使用 FFmpeg 进行帧提取

我想从多个视频中提取帧,但是当我运行extract_frames.py脚本时,遇到了此错误:

ffmpeg version N-93562-g3e10223385 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20190212
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt

  libavutil      56. 26.100 / 56. 26.100

  libavcodec     58. 50.100 / 58. 50.100

  libavformat    58. 27.102 / 58. 27.102

  libavdevice    58.  7.100 / 58.  7.100

  libavfilter     7. 48.100 /  7. 48.100

  libswscale      5.  4.100 /  5.  4.100

  libswresample   3.  4.100 /  3.  4.100

  libpostproc    55.  4.100 / 55.  4.100


train\Animation\Animation_1.avi: Permission denied

Generated 0 frames for Animation_1

我的理论是,subprocess.call此代码片段有一个错误:

src = os.path.join(train, classname, filename)

dest = os.path.join(train, classname, filename_no_ext + '-%04d.jpg')

subprocess.call(["ffmpeg" , "-i" , src , dest])

相关内容