Windows FFMPEG will not find my files at all
I have a folder full of images that go from 0 to whatever number, and I need to turn these images to a video. They are all .PNG files. Here is my command I am using:
ffmpeg.exe -f image2 -framerate 30 -pattern_type sequence -start_number 1 -r 30 -i "img%%04d.jpg" -s 1280x720 test.avi
When I run this I get this error:
[image2 @ 002be580] Could find no file with path 'img%04d.jpg' and index in the range 1-5
img%04d.jpg: No such file or directory
What can I change to get this to work?
Solution 1:
sequence pattern
The default pattern type. img%d.jpg
will expect img1.jpg
, img2.jpg
, etc. Using img%04d.jpg
will expect img0001.jpg
, img0002.jpg
, etc.
ffmpeg -framerate 30 -i img%d.jpg -vf scale=1280:-1,format=yuv420p output.mp4
glob pattern
A glob wildcard pattern type is flexible. This pattern type is available if libavformat was compiled with globbing support.
ffmpeg -framerate 30 -pattern_type glob -i "*.png" -vf scale=1280:-1,format=yuv420p output.mp4
Notes
See the FFmpeg image2 demuxer documentation for more info.
The
scale
filter in this example will change the width to 1280 and the height will be automatically calculated to preserve the aspect.Depending on your version, input type (such as PNG), encoder (libx264 specifically), and encoding options,
ffmpeg
may attempt to avoid or minimize chroma subsampling, but most non-FFmpeg based players will be unable to properly decode the output. Theformat
filter will ensure the output uses a chroma subsampling scheme that is compatible with these players.