Main optionsCommand syntax: | ffmpeg [global-options] [[infile-options][-i infile]]... {[outfile-options] outfile}... | Display input stream information: | ffmpeg -i video.avi |
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 audio, video, subtitle text, still images, fonts, etc.
Global options-y | Overwrite output files | -n | Do not overwrite output files |
Main options-f fmt | force input or output file format | -i fName | input file name. If specified with no output file, a summary of the content streams is shown | -c codecName | specify codec [input or output] | -fs Nbytes | specify maximum output file size in Nbytes |
The file extension typically determines the file format, so the '-f' option is not needed in most cases.
Size specificationK or k | 103 | 1000 bytes | Kilobytes | M | 106 | 1000000 bytes | Megabytes | G | 109 | 1000000000 | Gigabytes | | Ki | 210 | 1024 | Kibibyte | Mi | 220 | 1048576 | Mebibyte | Gi | 230 | 1073741824 | Gibibyte |
suffices used with most numerical values
Help options-h -? -help --help | Show basic help | -h long | Show more help | -h full | Show all options, including all format and codec specific options | -version | Show version | -formats | Show available formats | -codecs | Show available codecs | -protocols | Show available protocols | -filters | Show available libavfilter filters | -sample_fmts | Show available sample formats | -bsfs | Show available bitstream filters | -pix_fmts | Show available pixel formats | -v value -loglevel value | Log output verbosity value is an integer, or one of: quiet, panic, fatal, error, warning, info, verbose, debug |
Subtitle options-slang code | Set the ISO 639 language code (3 letters) of the current subtitle stream. | -scodec codec | Set the subtitle codec. This is an alias for -codec:s. Use 'copy' to copy stream. | -sn | Disable subtitle recording. | -newsubtitle | add a new subtitle stream to the current output stream |
| | Video options-b bRate | set video bitrate (in kbit/s) | -fixaspect | fix aspect ratio | -bt tolerance | set video bitrate tolerance (in kbit/s) | -maxrate bRate -minrate bRate | set maximum or minimum video bitrate tolerance (in kbit/s) | -bufsize size | set ratecontrol buffer size (in kByte) | -sameq | use same video quality as source (implies VBR) | -newvideo | add a new video stream to the current output stream |
Specialist Video filters-vf vflip | Flip the input video vertically | -vf hflip | Flip the input video horizontally | -vf transpose=transSpec | Rotates or flips input video | transSpec is a list of values, colon separated. | dir=N:passthrough=orientation N = 0...7 ; passthrough is one of: none, portrait, landscape | -vf delogo=sizeSpec:t=t:show:N | Remove a logo from x,y for w,h pixels, with fuzzy band thickness t | -vf removelogo=imgFile | Use the black pixels in the bitmap image file to remove the logo | -vf drawbox=sizeSpec:color@opacity | draw a box border colour specification 0xhex and opacity [0...1] | sizeSpec is a list of values, colon separated. | x=x:y=y position from top left corner w=width:h=height width and height |
Audio Options-ab bRate | set audio bitrate (in kbit/s) | -aframes N | Set the number of audio frames to record. [an alias for -frames:a] | -aq q | Set the audio quality (codec-specific, VBR). [an alias for -q:a] | -an | Disable audio recording | -acodec codec | Set the audio codec. [an alias for -codec:a] Use 'copy' to copy stream. | -vol | Change the audio volume in multiples of 256 where 256 = 100% (normal) volume. e.g. 512 = 200% | -newaudio | add a new audio stream to the current output stream | -alang code | set the ISO 639 language code (3 letters) of the current audio stream |
Useful examplesTranscode input file to DVD PAL format | ffmpeg -y -threads 8 -i inFile -target pal-dvd -ac 2 -aspect 16:9 -acodec mp2 -ab 224000 -vf pad=0:0:0:0 outFile | Convert to grayscale | ffmpeg -y -i inFile -flags gray outFile | Create 1 minute of audio noise | ffmpeg -ar 48000 -t 60 -f s16le -acodec pcm_s16le -i /dev/urandom -ab 64K -f mp2 -acodec mp2 -y noise.mp2 | Extract images from video | ffmpeg -i foo.avi -r 1 -s WxH -f image2 outFile%03d.png | Convert image file to other formats | ffmpeg -i foo0122.png foo.tiff pgm, ppm, pam, pgmyuv, jpeg, gif, png, tiff, sgi | Convert images to AVI file | ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi | Convert a WAV file to MP3 | ffmpeg -i source_song.wav -vn -ar 44100 -ac 2 -ab 192 -f mp3 final_song.mp3 | Extract audio from a video, transcoding it to MP3 | ffmpeg -i source.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 sound.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 animated gif | ffmpeg -i video.avi animated.gif | Attach a picture to an mp3 | ffmpeg -i input.mp3 -i cover.png -c copy -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" out.mp3 | Mix a video with a sound file | ffmpeg -i song.wav -i source_video.avi outvideo.mpg | Write an mp3 with an ID3v2.3 header and an ID3v1 footer | ffmpeg -i inFile -id3v2_version 3 -write_id3v1 1 outFile.mp3 | Concatenate input files | cat inFile1 inFile2 | ffmpeg -f mpeg -i - -vcodec copy -acodec copy outFile.mpg | Encode a clip with codec with bitrate, and mp3 audio | ffmpeg -i clip.avi -vcodec libxvid -b 800000 -acodec libmp3lame -ab 128 new-clip.avi | Merge audio stream with video stream from different files | ffmpeg -i audioS.mp4 -i videoS.mp4 -c copy -map 0:a -map 1:v outFile.mp4 |
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets