0

I want to take a folder of mp4s and with ffmpeg compress them and turn them into gifs.

I do this for each file using this code:

ffmpeg -i input.mp4 -c:v libx264 -tune zerolatency -preset ultrafast -crf 40 -c:a aac -b:a 32k output.mp4

-crf can go to 63 and I can adjust how compressed the result file will be.

But how do I run that code for a whole folder of mp4s and get all of them compressed and turned into gifs?

So I am reading all possible problems on this board and have found making a .bat file with this code and then running it in command prompt:

for %F in (*.mp4) do (If not Exist "%~nF" MkDir "%~nF" ffmpeg -i %F -r 1 -qscale:v 2 %~nF\%~nF-%3d.jpg)

does close to what I need (except this is for breaking down multiple mp4s into jpgs).

This code changes multiple mp4s into gifs I have found:

for %i in (*.mp4) do ffmpeg -i "%i" "%~ni.mp3

As you can see I am trying to really toy with these codes, each one is excellent but I would love a combined ffmpeg code that A) takes a folder full of mp4s b) compresses them where I can customize the -crf and c) converts them to gifs with either a prefix or suffix added on or some other way where I can still recognize what the original file was.

If there is a way to do this without a customizable -crf then that is doable.

Thank you all for any help!

RayRay
  • 1

0 Answers0