ffMpeg examples

Create a gif file

Create a new text file and save it with the extension “.bat”. Then copy the following code, change the settings accordingly.

@ECHO OFF
SET FFMPEG="c:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe"
SET SOURCE="d:\Temp\png\Dia%%d.PNG"
SET TARGET="d:\Temp\png\output.gif"

ECHO Convert source folder with images to gif
%FFMPEG% -f image2 -framerate 0.2 -i %SOURCE% %TARGET%
PAUSE

Grab images from a movie

Create a new text file and save it with the  extension “.bat”. Then copy the following code, change the settings accordingly.

@ECHO OFF
SET FFMPEG="c:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe"
SET MOVIE=”MovieName.mp4″
SET OUTPATH=”c:\Temp\Output\”

ECHO 1. Start converting video to audio, later used to extract transcript
%FFMPEG% -i %MOVIE% -map 0:1 -acodec pcm_s16le -ac 2 %MOVIE%.wav

ECHO 2. Convert video to images
%FFMPEG% -i %MOVIE% -vf fps=1/60 jpgIMG_%%05d.jpg/
PAUSE

Resize image

Create a new text file and save it with the extension “.bat”. Then copy the following code, change the settings accordingly.

@ECHO OFF
SET FFMPEG="c:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe"
SET SOURCEIMG="c:\Temp\IMG_0001.jpeg"
SET TARGETIMG="c:\Temp\IMG_0001_SMALL.jpeg"

ECHO Resize image 1024x1024
%FFMPEG% -i  %SOURCEIMG% -vf scale=1024:-1 %TARGETIMG%
PAUSE

FFmpeg References