FFMPEG is a fast and reliable command‑line tool that works perfectly in a classic DOS batch. It runs without a GUI, accepts simple arguments, and can be chained in .bat files for tasks like converting, trimming, or extracting audio and video. Because it supports almost every media format, you rarely need extra tools. Its predictable command‑line behavior makes it easy to automate repeatable jobs, and it performs consistently across systems, even in lightweight or older environments.
Examples
To try out the examples below, you first need to have FFMPEG installed. Start by downloading and installing the tool.
Convert FLAC to MP3
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\flac\input.flac"
SET TARGET="d:\Temp\mp3\output.mp3"
ECHO Convert source FLAC to MP3
%FFMPEG% -i %SOURCE% -ab 320k -map_metadata 0 -id3v2_version 3 %TARGET%
PAUSEConvert WAV to FLAC
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\wav\input.wav"
SET TARGET="d:\Temp\flac\output.flac"
ECHO Convert source WAV to FLAC
%FFMPEG% -i %SOURCE% -af aformat=s16:44100 %TARGET%
PAUSECreate 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%
PAUSEGrab 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/
PAUSEResize 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