KEMBAR78
FFmpeg Command Guide | PDF | Mp3 | Codec
0% found this document useful (0 votes)
406 views3 pages

FFmpeg Command Guide

This document provides a cheat sheet for the ffmpeg command line tool. It lists main options, help options, input/output stream information, global options, size specifications, video options, audio options, subtitle options, and some examples of useful ffmpeg commands for tasks like transcoding files, setting bitrates, and attaching images to audio files. The cheat sheet is organized into sections for easy reference of ffmpeg's many encoding, decoding, filtering and muxing/demuxing options.

Uploaded by

weakhand
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
406 views3 pages

FFmpeg Command Guide

This document provides a cheat sheet for the ffmpeg command line tool. It lists main options, help options, input/output stream information, global options, size specifications, video options, audio options, subtitle options, and some examples of useful ffmpeg commands for tasks like transcoding files, setting bitrates, and attaching images to audio files. The cheat sheet is organized into sections for easy reference of ffmpeg's many encoding, decoding, filtering and muxing/demuxing options.

Uploaded by

weakhand
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

ffmpeg Cheat Sheet

by thetartankilt via cheatography.com/853/cs/344/

Main options Help options

Command syntax: ffmpeg [globa​l-o​ptions] [[infi​le-​opt​ion​s][-i infile​]]... -h Show basic help


{[outf​ile​-op​tions] outfil​e}... -?
-help
Display input stream ffmpeg -i video.avi
--help
inform​ation:
-h long Show more help
Many of the audio/​video file formats [such as WAV, AIFF, MP4, MKV, AVI,
etc.] are envelope containers for multiple streams of data content such as -h full Show all options, including all format and codec specific
audio, video, subtitle text, still images, fonts, etc. options

-version Show version


Global options -formats Show available formats

-y Overwrite output files -codecs Show available codecs


-n Do not overwrite output files -protocols Show available protocols

-filters Show available libavf​ilter filters


Main options
-sample_fmts Show available sample formats
-f fmt force input or output file format
-bsfs Show available bitstream filters
-i ​fName input file name. If specified with no output file, a
-pix_fmts Show available pixel formats
summary of the content streams is shown
-v value Log output verbosity
-c codecName specify codec [input or output]
-loglevel value value is an integer, or one of: quiet, panic, fatal, error,
-fs Nbytes specify maximum output file size in Nbytes warning, info, verbose, debug

The file extension typically determines the file format, so the '-f' option is
not needed in most cases. Subtitle options

-slang code Set the ISO 639 language code (3 letters) of the current
Size specif​ication subtitle stream.

K or k 103 1000 bytes Kilobytes -scodec Set the subtitle codec. This is an alias for-code​c:s. Use
codec 'copy' to copy stream.
M 106 1000000 bytes Megabytes
-sn Disable subtitle recording.
G 109 1000000000 Gigabytes
-newsubtitle add a new subtitle stream to the current output stream

Ki 210 1024 Kibibyte

Mi 220 1048576 Mebibyte

Gi 230 1073741824 Gibibyte

suffices used with most numerical values

By thetartankilt Published 25th April, 2017. Sponsored by CrosswordCheats.com


cheatography.com/thetartankilt/ Last updated 22nd March, 2018. Learn to solve cryptic crosswords!
Page 1 of 3. http://crosswordcheats.com
ffmpeg Cheat Sheet
by thetartankilt via cheatography.com/853/cs/344/

Video options Specialist Video filters (cont)

-b bRate set video bitrate (in kbit/s) -vf draw a box border

-fixaspect fix aspect ratio drawbo​x=​size


​ Sp​ec​:co​lor​@op​acity colour specif​ication 0xhex and
opacity [0...1]
-bt toler​ance set video bitrate tolerance (in kbit/s)
sizeSpec is a list of values, colon x=x:y=y
-maxrate bRate set maximum or minimum video bitrate tolerance (in
separated. position from top left corner
-minrate bRate kbit/s)
w=width:h=height
-bufsize size set rateco​ntrol buffer size (in kByte) width and height
-sameq use same video quality as source (implies VBR)
Audio Options
-newvideo add a new video stream to the current output stream
-ab bRate set audio bitrate (in kbit/s)
Specialist Video filters
-aframes N Set the number of audio frames to record. [an alias for -

-vf vflip Flip the input video vertically frames:a]

-vf hflip Flip the input video horizo​ntally -aq q Set the audio quality (codec​-sp​ecific, VBR). [an alias for
-q:a]
-vf transpose=transSpec Rotates or flips input video
-an Disable audio recording
trans​Spec is a list of values, dir=N:passthrough=orientation
colon separated. N = 0...7 ; passth​rough is one of: none, -acodec codec Set the audio codec. [an alias for -codec:a]

portrait, landscape Use 'copy' to copy stream.

-vf delogo=sizeSpec:t=t:show:N Remove a logo from x,y for w,h pixels, -vol Change the audio volume in multiples of 256 where 256

with fuzzy band thickness t = 100% (normal) volume. e.g. 512 = 200%

-vf removelogo=imgFile Use the black pixels in the bitmap -newaudio add a new audio stream to the current output stream
image file to remove the logo -alang code set the ISO 639 language code (3 letters) of the current
audio stream

By thetartankilt Published 25th April, 2017. Sponsored by CrosswordCheats.com


cheatography.com/thetartankilt/ Last updated 22nd March, 2018. Learn to solve cryptic crosswords!
Page 2 of 3. http://crosswordcheats.com
ffmpeg Cheat Sheet
by thetartankilt via cheatography.com/853/cs/344/

Useful examples Useful examples (cont)

Transcode input file ffmpeg -y -threads 8 -i inFile -target pal-dvd -ac 2 - Attach a picture to an ffmpeg -i input.mp3 -i cover.png -c copy -
to DVD PAL format aspect 16:9 -acodec mp2 -ab 224000 -vf mp3 metad​ata:s:v title=​"​Album cover" -metad​ata:s:v
pad=0:​0:0:0 outFile commen​t="Cover (Front​)" out.mp3

Convert to grayscale ffmpeg -y -i inFile -flags gray outFile Mix a video with a ffmpeg -i song.wav -i source​_vi​deo.avi

Create 1 minute of ffmpeg -ar 48000 -t 60 -f s16le -acodec pcm_s16le sound file outvid​eo.mpg

audio noise -i /dev/u​random -ab 64K -f mp2 -acodec mp2 -y Write an mp3 with an ffmpeg -i inFile -id3v2​_ve​rsion 3 -write​_id3v1 1
noise.mp2 ID3v2.3 header and outFil​e.mp3

Extract images from ffmpeg -i foo.avi -r 1 -s WxH -f image2 an ID3v1 footer

video outFil​e%0​3d.png Concat​enate input cat inFile1 inFile2 | ffmpeg -f mpeg -i - -vcodec

Convert image file to ffmpeg -i foo012​2.png foo.tiff files copy -acodec copy outFil​e.mpg

other formats pgm, ppm, pam, pgmyuv, jpeg, gif, png, tiff, sgi Encode a clip with ffmpeg -i clip.avi -vcodec libxvid -b 800000 -
codec with bitrate, acodec libmp3lame -ab 128 new-cl​ip.avi
Convert images to ffmpeg -f image2 -i foo-%0​3d.jpeg -r 12 -s WxH
and mp3 audio
AVI file foo.avi

Convert a WAV file ffmpeg -i source​_so​ng.wav -vn -ar 44100 -ac 2 -ab Merge audio stream ffmpeg -i audioS.mp4 -i videoS.mp4 -c copy -
with video stream map 0:a -map 1:v outFil​e.mp4
to MP3 192 -f mp3 final_​son​g.mp3
from different files
Extract audio from a ffmpeg -i source.avi -vn -ar 44100 -ac 2 -ab 192 -f
video, transc​oding it mp3 sound.mp3
to MP3

Convert .avi to .flv ffmpeg -i source.avi -ab 56 -ar 44100 -b 200 -r 15


-s 320x240 -f flv output.flv

Convert .avi to ffmpeg -i video.avi animat​ed.gif


animated gif

By thetartankilt Published 25th April, 2017. Sponsored by CrosswordCheats.com


cheatography.com/thetartankilt/ Last updated 22nd March, 2018. Learn to solve cryptic crosswords!
Page 3 of 3. http://crosswordcheats.com

You might also like