Information
Program info
See FFmpeg version and compile flags:
ffmpeg -versionShow supported decoders:
ffmpeg -decodersShow supported encoders:
ffmpeg -encodersShow supported demuxers and muxers:
ffmpeg -formatsShow supported filters:
ffmpeg -filtersShow supported codecs:
ffmpeg -codecsShow supported protocols:
ffmpeg -protocolsShow available sources:
ffmpeg -sources
File info
Get information about file:
ffmpeg -i input.mp4 -hide_banner
Converting
Convert from MP4 container to MKV:
ffmpeg -i input.mp4 output.mkvCopy everything but re-encode audio:
ffmpeg -i input.mp4 -map 0 -c copy -c:a libmp3lame output.mp4Copy everything but re-encode video:
ffmpeg -i input.mkv -map 0 -c copy -c:v mpeg2video output.mkv
Extracting
Create sample of 2 minutes:
ffmpeg -ss 00:10:00 -i input.mp4 -t 00:02:00 output.mp4Extract audio track only from video file:
ffmpeg -i input.mp4 -vn audio.mp3Extract video track only from video file:
ffmpeg -i input.mp4 -an video.mp4Extract video, audio and subtitle to separate files:
ffmpeg -i input.mkv -map 0:0 video.mkv -map 0:1 audio.mkv -map 0:2 subtitle.srtExtract and convert WebVTT subtitle to SubRip format:
ffmpeg -txt_format webvtt -i input.mkv subtitle.srtExtract and convert multiple WebVTT subtitles to SubRip format:
ffmpeg -txt_format webvtt -i input.mkv -map 0:2 subtitle.spa.srt -map 0:3 subtitle.eng.srt
Modifying
Add subtitles to a video (with appropriate metadata):
ffmpeg -i input.mp4 -i subtitle.spa.srt -i subtitle.eng.srt -map 0 -map 1 -map 2 -metadata:s:s:0 language=spa -metadata:s:s:1 language=eng -c copy output.mp4Change resolution of video:
ffmpeg -i input.mp4 -filter:v scale=1280:720 output.mp4Crop video:
ffmpeg -i input.mp4 -filter:v crop=640:480:100:100 output.mp4
Splitting and joining
Split video file into multiple parts of 20 seconds each:
ffmpeg -i input.mp4 -map 0 -c copy -segment_time 00:20:00 -f segment -reset_timestamps 1 output%03d.mp4Join multiple video files into one:
printf "file '%s'\n" ./input*.mp4 > mylist.txt && ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4Combine two videos in split screen (side by side):
ffmpeg -i left.mp4 -i right.mp4 -filter_complex hstack output.mp4