Adam Fenton
Adam Fenton

Reputation: 1

What is the correct command line format for ffmpeg in this case

I apologise if this is a duplicate. I have used ffmpeg in the past to convert .pngs to .mp4 but now I am using it on my own files and I am not sure of the format it should have. I have some files with the following naming convention:

   ./profiles_0.png
   ./profiles_40.png
   ...
   ./profiles_400.png

The number of files I have varies, i.e. it isn't always 400 and the interval isn't always going to be 40. I have tried the following:

ffmpeg -framerate 1 -i profiles_%d0.png -r 6 -pix_fmt yuv420p out.mp4

but that only captures one of the images. Is there a flexible format in the 'profiles_%d0.png" argument that captures all of the files in that directory regardless of the number of characters following the underscore or does it require that I change my naming convention?

Cheers for any help, A

Upvotes: 0

Views: 87

Answers (1)

Jao
Jao

Reputation: 586

If you only have the images of interest in your folder it's easy. You can use a command similar to yours, examples are given in this other question. Basically you can match the files with a wildcard operator and their extension, *.png in that case. It could look like this:

ffmpeg -f image2 -pattern_type glob -i '*.png' out.avi

This is only selectable if libavformat was compiled with globbing support.

According to FFmpeg's documentation on the image2 demuxer.

If you have other files with other numbering or if you have a sequence of files and want to select a subsequence, I see no way to do it automatically but you can specify such sequence. You'll still need to use glob, you can get help on the use of globs in FFmpeg there and more information on glob programming here.

Upvotes: 1

Related Questions