Lucas Naoki
Lucas Naoki

Reputation: 1

How to create a full length video from images with FFmpeg?

I have more than a thousand images that I want to transform into a 3 minutes video. I tried using this line ffmpeg -r 30 -i "E:/White-box-Cartoonization/test_code/cartoonized_images/$flower%03d.bmp" -c:v libx264 -pix_fmt yuv420p out.mp4 it worked but creates only a 5 seconds video. What do I need to do to turn it into a full length 3 minutes video?

Upvotes: 0

Views: 3642

Answers (2)

llogan
llogan

Reputation: 134233

If you have 1250 images and want an output duration of 180 seconds:

ffmpeg -framerate 1250/180 -i input%03d.bmp -c:v libx264 -vf format=yuv420p output.mp4

This example results in a frame rate of 6.94. Some players can't handle such low frame rates. If your player does not like it then add the -r output option to make a normal output frame rate. ffmpeg will duplicate the frames but the output will look the same.

ffmpeg -framerate 1250/180 -i input%03d.bmp -c:v libx264 -vf format=yuv420p -r 25 output.mp4

Upvotes: 2

PaulProgrammer
PaulProgrammer

Reputation: 17690

For 3 minutes of video at 30 frames per second (-r parameter) you'd need 30*60*3 images: 5400 images.

Your source parameter specifies there would be only 3 digits, so you have a maximum of 1000 source images:

$flower%03d.bmp => $flower000.bmp .. $flower999.bmp

1000 images at 30 frames per second should give about 30 seconds of video ... if you actually have $flowerxxx.bmp files.

You might need a 4th digit in there somewhere.

$flower%04d.bmp

Upvotes: 1

Related Questions