0
votes

ffmpeg -framerate 30 -i %1d.png -c:v libx264 -profile:v high -crf 10 -pix_fmt yuv420p test.mp4

Hi,

I have a folder with a bunch of png images: 0.png, 1.png, 2.png ... Using the above code, I can convert all the images in the directory into one video. What I want to do is only convert a percentage of all the images into a video. Is there any way I can specify to ffmpeg to only convert the first 20% of images into a video? For example if there is 50 images, ffmpeg in this case would only use the first 10 images to form a video.

1
Automatically, no. Manually, add -vframes 10.Gyan

1 Answers

0
votes

You could use -start_number and -frames:v. -start_number accepts an expression but -frames:v does not. So you could use some scripting to calculate frames from percentage.

ffmpeg -framerate 30 -start_number <frame_number> -i %1d.png -frames:v <frames> -c:v libx264 -profile:v high -crf 10 -pix_fmt yuv420p test.mp4
  • -start_number: Start at index frame number.
  • -frames:v: number of output frames.

-vframes is depricated according to the manual. https://www.ffmpeg.org/ffmpeg-all.html#toc-Video-Options