Convert GIF folders to video files at once with D & D !! (for Windows)

1 minute read

  • Targets folders containing only GIF.

First, let’s download ffmpeg.
For example, you can get a pre-built one from the following sites. (Link below such as release)
All you need is ffmpeg.exe in the bin folder, so unzip and save it in any folder.
https://www.gyan.dev/ffmpeg/builds/

Then open Notepad and copy everything below
Save it as “your favorite name.vbs” in the same folder as the ffmpeg you downloaded earlier.
By default, the file is saved on the desktop.
Replace the saveFolder part at the top with C: \ Videos \ as appropriate.

rem Enter the name of the final output folder(Be sure to end\so)-----
  Dim saveFolder
  saveFolder = "%systemdrive%\Users\%username%\Desktop\"

rem ffmpeg command--------------------------------------------
   Dim ffmpegArgments,encoderArgments,destExtension
   ffmpegArgments = "-movflags faststart -pix_fmt yuv420p -vf ""scale=trunc(iw/2)*2:trunc(ih/2)*2"""
   encoderArgments = "-vcodec libx265 -preset slow -crf 24"
   destExtension = "mp4"

rem You probably don't need to change anything below here--------------------------
   Dim arg,fso,folder,wshell,thisfolder,file
   arg=WScript.Arguments(0)
    
   Set fso= CreateObject("Scripting.FileSystemObject")
   Set folder = fso.getFolder(arg)
   Set wshell = CreateObject("WScript.Shell")
   thisFolder = fso.getParentFolderName(WScript.ScriptFullName)

  For Each file in folder.files
        str = thisFolder & "\ffmpeg.exe -i " & file.Path &  " " & _
                 ffmpegArgments  &  " " &  _
                 encoderArgments  &  " " &  _
                 saveFolder  & fso.GetbaseName(file) & destExtension
       wshell.run str,true,true
   Next 

  Set folder = Nothing
  Set fso = Nothing
  Set wshell = Nothing

By dragging and dropping the folder containing the gif to the saved vbs file, it will be converted to an mp4 file in saveFolder and saved.
Also, by putting a shortcut in the Sendto folder, you can convert it by right-clicking the folder and sending it.
You can open the sendto folder by pressing windows and R at the same time, typing Shell: sendto, and pressing Enter.

By default, conversion is done with a slow preset of x265, so if speed is important, use encoderArgments at the top.
encoderArgments = “-vcodec libx265 -preset fast -crf 24”
And so on.
If you want to output in h264
encoderArgments = “-vcodec libx264 -preset fast -crf 24”
And so on.