2

I am currently using the following command to create image gifs from a video

ffmpeg -i '/home/video/test.mp4' -vf fps=1/180 '/home/video/test.mp4%03d.jpg' && ffmpeg -framerate 1 -i '/home/video/test.mp4%03d.jpg' -vf scale=160x110 -r 30 '/home/video/test.mp4.gif'

I would like to modify this command so that it can be used for every .mp4 file in a folder instead of just test.mp4 as shown above.

2

use for loop of shell script in your case

for i in *.mp4 ;
do
   ffmpeg -i "$i" -vf fps=1/180 "/home/video/$i%03d.jpg" && ffmpeg -framerate 1 -i "/home/video/$i%03d.jpg" -vf scale=160x110 -r 30 "/home/video/$i.gif";
done;

either run it directly or store it in a file say xyz.txt and run source xyz.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.