ffmpeg Commands

FFmpeg allows you to record, convert and stream digital audio and video in various formats.

The installation guide can be found here


ffmpeg -i [source].flv -vn acodec copy [dest].mp3
Copy the sound of a video to an mp3
ffmpeg -i [source].avi -s 320x240 -b 1000k -vcodec wmv2 -ar 44100 -ab 56000 -ac 2 -y [dest].wmv
Convert AVI to WMV
ffmpeg -i [source].flv -vcodec mpeg2video target_video.m2v -acodec copy [dest].mp3
Extract audio & video from a movie.
ffmpeg -i [source].flv -f mp3 -vn -acodec copy [dest].mp3
Extract audio from flv to mp3
ffmpeg -i [source].avi -y -f vcd -vcodec mpeg1video -map 0.0:0.0 -b 1150 -s 352x240 -r 29.97 -g 12 -qmin 3 -qmax 13 -acodec mp2 -ab 224 -ar 44100 -ac 2 -map 0.1:0.1 [dest].mpg
Convert plain .avi movies to .mpeg
ffmpeg -i [source].flv -r 15 -b 128k -s qcif -acodec amr_nb -ar 8000 -ac 1 -ab 13 -f 3gp -y [dest].3gp Convert .flv to .3gp
ffmpeg -i [source].flv
Get video information with ffmpeg
for f in *.flv; do ffmpeg -y -i "$f" -f image2 -ss 10 -vframes 1 -an "${f%.flv}.jpg"; done
For all flv files in a dir, grab the first frame and make a jpg.
ffmpeg -i [source].avi -f mp3 [dest].mp3
Extract audio from a video
ffmpeg -vcodec copy -acodec copy -i orginalfile -ss 00:01:30 -t 0:0:20 [dest]
Cut out a piece of film from a file.
ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 [dest].mpg
Capture video from X11
ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq [dest].mpg
Capture video of a linux desktop
ffmpeg -i [source].avi -s 480x320 -aspect 4:3 -b 768k -ab 64k -ar 22050 -r 30000/1001 [dest].mp4
Convert avi to iphone format
find ~/[dir] -name "*.m4a" -exec ffmpeg -i {} -acodec mp3 -ac 2 -ab 128 "{}.mp3" \; 
Convert m4a to mp3

About the Author


R Donato

Rick Donato is the Founder and Chief Editor of He currently works as a Principal Network Security Engineer and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001