简体   繁体   中英

extract frames using ffmpeg with corresponding frame number

I am trying to extract frames using FFMPEG using the following command:

 ffmpeg.exe ' -i ' videoFile ' -r 1/5 ' imgsFolder '\%5d.png'

Its extracting frames and assigning frame names in a sequential manner such 0, 1, ...

Is it possible to assign the actual frame number as part of the extraction?

For example, if the ffmpeg extracts 10th, 20th ...frames, it should name it img00010, img00020 instead of img00000, img00001....

You can change the start number, by using '-start_number XX'.

But you can not change the increment of that number (I double checked with source code of ffmpeg).

Probably, it would be better to run a shell script that will rename your files. I can see that you are running in under Windows, so I'm not sure if you have bash there. But under linux it would look like this:

index=0
increment=10
prefix="new_"
for i in *.png; do printf "%s_%05d.png" $prefix $index; index=$[index+$increment]; done

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM