Batch extracting frames from multiple mp4 file

2019-08-01 10:10发布

问题:

So i have a folder with only mp4 files. I just want to get specific frames for every mp4 files automatically. I tried the below command, but it tried overwriting the mp4 file, is there any error with the below command? So i expect to input a mp4 file and to get 3 frames in .jpg format.

for i in *.mp4; do 
   ffmpeg -i *.mp4 -vf select='eq(n\,10)+eq(n\,17)+eq(n\,21)' -vsync 0 frames%d.jpg
done

回答1:

I am no expert on ffmpeg but you have some fairly fundamental issues in your script. Hopefully, this will get you started:

for i in *.mp4; do 
   ffmpeg -i "$i" -vf select='eq(n\,10)+eq(n\,17)+eq(n\,21)' -vsync 0 "${i%.*}_frames%d.jpg"
done