FFmpeg is the Swiss-army-knife command-line engine behind almost every modern media player, converter, and streaming pipeline. Whether you are batch-converting DJ mixes, extracting lossless audio, resizing 4K captures, or remuxing containers with zero quality loss, FFmpeg handles it directly from the terminal.
Master FFmpeg on Windows, Linux, and macOS with ready-to-copy terminal commands for converting formats, extracting audio, trimming clips, and H.264 compression.
01 // Installation Across Platforms
winget install Gyan.FFmpegsudo pacman -S ffmpeg
sudo apt install ffmpeg
sudo dnf install ffmpegbrew install ffmpeg02 // Essential Terminal Commands
Convert Container Format (Zero Re-Encoding)
REMUX // INSTANTSwaps the container (e.g., MKV to MP4) without re-encoding video or audio streams—completes in seconds with zero quality loss.
ffmpeg -i input.mkv -c copy output.mp4Extract Audio from Video
AUDIO // MP3 V0Strips the audio track from a recorded live stream or video file and encodes it as high-bitrate variable MP3.
ffmpeg -i video.mp4 -vn -q:a 0 audio.mp3Resize Video to 720p
SCALE // 1280×720Downscales high-resolution footage cleanly to 1280×720 HD for web uploads or lightweight sharing.
ffmpeg -i input.mp4 -vf "scale=1280:720" -c:a copy output.mp4Trim Clip by Timestamp
CUT // -SS TO -TOExtracts a segment between 00:00:10 and 00:01:00 using stream copy so no re-encoding is required.
ffmpeg -ss 00:00:10 -to 00:01:00 -i input.mp4 -c copy clip.mp4Compress & Re-Encode to H.264
LIBX264 // CRF 23Balances file size and visual sharpness using Constant Rate Factor (-crf 18 for near-lossless, -crf 23 for standard web).
ffmpeg -i input.mp4 -c:v libx264 -preset fast -crf 23 -c:a aac -b:a 192k output.mp4Capture Frame Screenshot at Timestamp
FRAME GRAB // PNG / JPGSeeks directly to 10 seconds before decoding so it grabs a single lossless PNG (or JPEG) frame almost instantaneously.
ffmpeg -ss 00:00:10 -i input.mp4 -vframes 1 output.png-ss 00:00:10— Placed before-ifor fast keyframe seeking to the 10-second mark.-vframes 1— Captures exactly one single video frame and exits.output.jpg— Swap the extension to.jpgif you want a smaller JPEG thumbnail instead of PNG.


