Skip to content

Instantly share code, notes, and snippets.

@ni554n
Last active February 3, 2024 21:15
Show Gist options
  • Save ni554n/230b8b7c7fead492ebe40760d1a5591d to your computer and use it in GitHub Desktop.
Save ni554n/230b8b7c7fead492ebe40760d1a5591d to your computer and use it in GitHub Desktop.
Convert a folder of GIFs to WEBM with FFMPEG.
@ECHO off
ECHO :: GIF to WEBM Converter ::
ECHO ---------------------------
:: Replace this ffmpeg variable value with your own ffmpeg.exe path.
SET ffmpeg=%USERPROFILE%\Programs\JDownloader\tools\Windows\ffmpeg\x64\ffmpeg.exe
SET command=%ffmpeg% -i "%%f" -c:v libvpx-vp9 -b:v 0 -crf 30 -an -f webm -passlogfile "%TEMP%\ffmpeg2pass.log"
SET /P folder="Input directory path: "
rem Remove double quote from input string
SET folder=###%folder%###
SET folder=%folder:"###=%
SET folder=%folder:###"=%
SET folder=%folder:###=%
FOR %%f IN ("%folder%\*.gif") DO (
%command% -pass 1 -y NUL && %command% -pass 2 "%%~nf.webm"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment