Nash G-L
Nash G-L

Reputation: 11

How to convert a lump set of PPM files to a single .mp4 video using ffmpeg

I'm trying to convert some .ppm files into a single video using ffmpeg. The images are listed as image10.ppm, image20.ppm, all the way up to image2000.ppm

Essentially, there are 200 images following the format of image(1-200)0.ppm in a single folder.

I've navigated to the correct folder containing the images using cd and the terminal displays this folder as the directory I'm in.

Inputting the following command into the terminal:

ffmpeg -r 10 -f image2 -s 500x500 -i image%04d.ppm -vcodec libx264 -crf 25  -pix_fmt yuv420p presentation_video.mp4

I get the error that says:

[image2 @ 0x7ff36180ba00] Could find no file with path 'image%04d.ppm' and index in the range 0-4
image%04d.ppm: No such file or directory

What am I missing? I've just downloaded ffmpeg and am fairly new in general to command line interface.

Upvotes: 1

Views: 4585

Answers (1)

llogan
llogan

Reputation: 134073

Your image inputs file names do not contain leading zeros, such as image0002.ppm, so use the the sequence pattern image%d.ppm:

ffmpeg -framerate 10 -i image%d.ppm -c:v libx264 -crf 25 -vf "scale=500:500,format=yuv420p" -movflags +faststart output.mp4

See the image demuxer documentation for more details about the sequence pattern.

Upvotes: 3

Related Questions