A complete, cross-platform solution to record, convert and stream audio and video.

Installation

Download

Move FFmpeg folder to a location of your choice, such as C:\Program Files\.

Enable FFmpeg Through Command Prompt

  1. Control Panel → System and Security → System → Advanced system settings
  2. Advanced Tab → Environment Variables → System variables → Path
  3. Add C:\Program Files\FFmpeg\ (Separate multiple paths with semicolon ;)

Typing ffmpeg in CMD will now launch without needing to specify a direct path.

Linux Compile

sudo apt-get install git yasm
 
sudo apt-get install -y autoconf dh-autoreconf automake build-essential libgnutls28-dev
 
sudo apt-get install -y libass-dev libfreetype6-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev libx264-dev libvorbis-dev libvpx-dev libfdk-aac-dev libopenjpeg-dev zlib1g-dev libavcodec-extra openssl libssl-dev
 
autoreconf -i
 
mkdir ~/src
cd ~/src
git clone http://source.ffmpeg.org/git/ffmpeg.git
cd ffmpeg
 
./configure --enable-version3 --enable-gnutls --enable-gpl --enable-nonfree --disable-shared --enable-libfdk-aac --enable-libx264 --enable-libvorbis --enable-libvpx --enable-decoder=png --enable-encoder=png --enable-libopenjpeg --enable-openssl --enable-postproc --enable-swscale --enable-avfilter
 
make && make install
 
sudo cp ~/src/ffmpeg/ffmpeg /usr/local/bin
sudo cp ~/src/ffmpeg/ffprobe /usr/local/bin
sudo cp ~/src/ffmpeg/ffserver /usr/local/bin

Command-line Parameters

ffmpeg -i [input file] [video codec] [video encoding] [video bit rate] [audio codec] [audio encoding] [audio bit rate] [additional options] [output file]

WEBM

ffmpeg -i input.avi -vcodec libvpx -b:v 1500K -crf 10 -pix_fmt yuv420p -deadline good -acodec libvorbis -quality good -cpu-used 0 -b:a 320k -sn -threads 2 -movflags faststart output.webm

MP4

ffmpeg -i input.avi -vcodec -crf libx264 18 -qcomp 0.8 -preset medium -acodec aac -strict experimental -b:a 400k -threads 2 output.mp4

GIF

ffmpeg -i input.avi -vf palettegen output.png
ffmpeg -i input.avi -i output.png -lavfi paletteuse -r 14 output.gif

Giflossy

ffmpeg -i input.avi -i output.png -lavfi paletteuse -r 14 output.gif && gifsicle -03 --lossy=80 --colors 256 -o output.gif input.gif

Cut

ffmpeg -i input.avi -ss 00:00:01 -to 00:00:15 -vcodec copy -vcodec copy output.webm

Scale

VP8

-vf scale=1280:720

Auto

-vf scale=-1:720

x264

Aspect must be divisible by 2

-vf scale="trunc(iw/2)*2:trunc(ih/2)*2"
-vf scale=1280:720
-vf scale="1281:721, crop=1280:720:0:0"

Auto

-vf scale=-2:720

Thumbnail

ffmpeg -y -i input.webm -vf "scale=674:-1, crop=500:280" -q:v 7 -ss 00:00:01.000 -vframes 1 output.jpg