使用FFMPEG将所有视频帧提取为图像 [英] Extract all video frames as images with FFMPEG
问题描述
我正在尝试使用FFMPEG将MP4视频文件转换为一系列jpg图像(out-1.jpg,out-2.jpg等),
I am trying to convert a MP4 video file into a series of jpg images (out-1.jpg, out-2.jpg etc.) using FFMPEG with,
mkdir frames
ffmpeg -i "%1" -r 1 frames/out-%03d.jpg
但是我不断收到错误,
[image2 @ 00000037f5a811a0]不能打开文件:
frames / out-C:\Applications\FFMPEG \toGIF.bat3d.jpg
av_interleaved_write_frame():输入/输出错误帧= 1 fps = 0.0
q = 5.9 Lsize = N / A时间= 00:00:01.00比特率= N / A视频:63kB音频:0kB
字幕:0kB其他流:0kB全局标头:0kB多路复用开销:
未知转换失败! / p>
[image2 @ 00000037f5a811a0] Could not open file : frames/out-C:\Applications\FFMPEG\toGIF.bat3d.jpg av_interleaved_write_frame(): Input/output error frame= 1 fps=0.0 q=5.9 Lsize=N/A time=00:00:01.00 bitrate=N/A video:63kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Conversion failed!
如果我取出%03d部分,转换有效但它只输出第一帧而程序会因错误而停止。
If I take out the %03d part, the conversion works but it only outputs the first frame and the program stops with error.
如何使用FFMPEG正确提取视频的所有帧?
How can I correctly extract all the frames of the video with FFMPEG?
推荐答案
使用
ffmpeg -i "%1" frames/out-%03d.jpg
一系列图像文件没有帧率。如果您想对视频文件进行取样,请在输入前使用 -r
。
A sequence of image files don't have a framerate. If you want to undersample the video file, use -r
before the input.
编辑:
ffmpeg -i "C:\Applications\FFMPEG\aa.mp4" "frames/out-%03d.jpg"
这篇关于使用FFMPEG将所有视频帧提取为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!