FFmpeg One-Liners I Use Every Week (Cheat Sheet)
· Tutorials
The FFmpeg one-liners I reach for every week \— compress, convert, extract audio, trim clips, and embed subtitles. Real file size comparisons included.
Last updated: July 20, 2026 \u00b7 5-minute read
I process video every week for this portfolio and various side projects. These are the exact FFmpeg commands I reach for \u2014 not a comprehensive reference, but the ones I actually use. Each one is a single line that I copy from a notes file and paste into the terminal. File sizes are from real test files on my machine.
Compress Video (H.264)
The command I use most often. Reduces file size while maintaining visual quality using CRF (Constant Rate Factor). Lower CRF means better quality but larger file.
Real numbers from a recent screen recording: - Input: 247 MB, 1080p, 3 minutes, H.264 (high bitrate) - Output (CRF 23): 18.4 MB \u2014 92.5% reduction - Output (CRF 28): 8.2 MB \u2014 96.7% reduction (noticeable quality loss on text) - Output (CRF 18): 41.6 MB \u2014 83.2% reduction (visually lossless)
CRF 23 is the sweet spot for web video. It looks good and the file size is manageable. For screen recordings where text clarity matters, CRF 18-20 is better.
The -preset medium option controls encoding speed. ultrafast encodes in seconds but produces larger files. veryslow produces the smallest files but takes forever. I use medium for everything.
Compress Video (H.265/HEVC)
H.265 gives roughly 40-50% better compression than H.264 at the same quality. The tradeoff is encoding time \u2014 about 3-5x slower on my M2 MacBook.
The -tag:v hvc1 flag ensures compatibility with Safari and iOS. Without it, the file uses the hev1 tag which some Apple devices cannot play.
Same test file: CRF 28 H.265 produces a 6.1 MB file versus 8.2 MB for H.264 at the same CRF. Worth the longer encode time for files that will be downloaded or streamed at scale.
Extract Audio
The -vn flag removes the video stream entirely. -q:a 2 is the highest quality VBR setting for MP3. For AAC: use -c:a aac -b:a 192k.
Trim a Clip
The -c copy flag is crucial \u2014 it copies the streams without re-encoding, which means the trim happens instantly regardless of file size. The downside is that it cuts at the nearest keyframe, which might not be frame-accurate. For frame-accurate cuts, remove -c copy and accept the re-encoding time.
Convert Formats
MOV to MP4 (iPhone recordings): bash ffmpeg -i input.mov -c:v libx264 -crf 23 -c:a aac -b:a 128k output.mp4
WebM (for web embedding): bash ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libopus -b:a 128k output.webm
GIF (for social media): bash ffmpeg -i input.mp4 -vf "fps=15,scale=480:-1:flags=lanczos" -c:v gif output.gif
The GIF command generates large files. For a 10-second clip at 480p, expect 5-15 MB. For anything longer than 15 seconds, use a WebM or MP4 instead.
Embed Subtitles
The movtext codec produces subtitles compatible with most players. For hard-burning subtitles into the video:
Hard-burned subtitles cannot be turned off by the viewer, but they work everywhere including platforms that do not support subtitle tracks.
A Reddit thread on r/ffmpeg has a more comprehensive list if you need anything beyond these basics. Browse the lab for the video processing pipeline I built with these commands, or check the projects to see them in action. The blog has more CLI tool guides.
---
Not affiliated with the FFmpeg project. All tests on Apple M2, macOS 15, FFmpeg 7.0. File sizes vary by source content.