Thursday, July 7, 2022

Convert Gif to MP4 via ffmpeg

The below command can be used to convert a GIF to an MP4 using the pre-requsite ffmpeg app on Windows:


1. Open notepad, create a bat file : e.g: "fmpg.bat" 

2. Add the following : replace paths as needed:

 cd [PathToFFMpeg]\FFMpeg\bin

echo fn %~n1

echo INFILE- %1

echo OUTFILE- [PathOutput]\%~n1.mp4

ffmpeg -i "%1" -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" [PathOutput]\%~n1.mp4


Usage:

fmpg "C:\MyGifs\1.gif"

Example:

No comments:

Post a Comment