ffmpeg-pro
Master FFmpeg for video/audio conversion, compression, trimming, subtitles, streaming, and batch processing.
Use this skill
- Read the full skill below — it’s all right here on this page. When you like it, hit copy.
- Paste it into a chat with Muse and add: “Please use this skill whenever I ask about ffmpeg pro. Remember it for our future conversations.”
- That’s it. Muse follows the playbook for relevant tasks, and you approve anything it does.
The full skill
Overview
FFmpeg is the Swiss Army knife of media: conversion, compression, trimming, subtitles, streaming, thumbnails, GIFs — all scriptable, all free. Professionals use it for batch pipelines no GUI can match. This skill covers the essential FFmpeg patterns: the flags you actually need, quality control, and recipes for the 20 tasks that cover 95% of real work.
When to use
-
Converting video/audio between formats and codecs
-
Compressing files for web delivery or messaging apps
-
Trimming, concatenating, or extracting clips without re-encoding
-
Burning in subtitles or extracting subtitle tracks
-
Batch-processing media files with scripts
Core concepts
-
- The basic anatomy.
ffmpeg -i input.mp4 [options] output.mp4. Input flags before-i, output flags after. Order matters;-ssbefore-iis fast seek, after is accurate seek.
- The basic anatomy.
-
- Codecs:
-c:vand-c:a.copy= stream copy (no re-encode, instant, lossless).libx264/libx265for video,aacfor audio. Default aac bitrate is low — always set-b:a 192kor higher.
- Codecs:
-
- Quality control: CRF. Constant Rate Factor:
-crf 23is default for x264 (lower = better quality, larger file). Sweet spots: 18-20 (high quality), 21-24 (web delivery), 28+ (small files, visible loss). One number beats bitrate guessing for most jobs.
- Quality control: CRF. Constant Rate Factor:
-
- Presets trade time for size.
-preset slowcompresses better thanultrafastat the same CRF — same quality, smaller file, longer encode. For one-off encodes,medium/slowis worth it; for live,ultrafast.
- Presets trade time for size.
-
- Filters:
-vfand-af. Video/audio filter chains:scale,crop,fps,subtitles,loudnorm,volume. Chain with commas:-vf "scale=1280:-1,subtitles=subs.srt".
- Filters:
-
- Never overwrite blindly. FFmpeg prompts before overwriting; in scripts use
-n(never overwrite) or-y(always). Test commands on copies first — a wrong flag can destroy the only copy.
- Never overwrite blindly. FFmpeg prompts before overwriting; in scripts use
Practical workflow
Essential recipes (adapt paths as needed):
-
Compress for web (H.264):
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 192k -movflags +faststart output.mp4(faststartmoves metadata to the front for web streaming.) -
Compress smaller (H.265):
ffmpeg -i input.mp4 -c:v libx265 -crf 26 -preset medium -c:a aac -b:a 160k -tag:v hvc1 output.mp4 -
Lossless trim (no re-encode):
ffmpeg -ss 00:01:30 -i input.mp4 -t 00:00:45 -c copy clip.mp4 -
Extract audio:
ffmpeg -i input.mp4 -vn -c:a libmp3lame -b:a 192k audio.mp3 -
Convert to GIF (high quality, two-pass palette):
ffmpeg -i input.mp4 -vf "fps=15,scale=480:-1:flags=lanczos,palettegen" palette.pngffmpeg -i input.mp4 -i palette.png -lavfi "fps=15,scale=480:-1:flags=lanczos[x];[x][1:v]paletteuse" out.gif -
Burn in subtitles:
ffmpeg -i input.mp4 -vf "subtitles=subs.srt:force_style='FontSize=18'" -c:a copy out.mp4 -
Extract thumbnail strip / single frame:
ffmpeg -ss 00:00:10 -i input.mp4 -frames:v 1 thumb.jpg -
Concatenate same-codec files:
- Write a list file (
file 'a.mp4'per line), then:ffmpeg -f concat -safe 0 -i list.txt -c copy joined.mp4
- Write a list file (
-
Normalize loudness (podcast to -16 LUFS):
ffmpeg -i in.wav -af loudnorm=I=-16:TP=-1.5:LRA=11 out.wav -
Batch convert a folder:
for f in *.mov; do ffmpeg -i "$f" -c:v libx264 -crf 23 -c:a aac -b:a 192k "${f%.mov}.mp4"; done
Common pitfalls
-
- Forgetting
-c:abitrate. Default AAC bitrate (~128k or lower) can audibly degrade. Always set it explicitly.
- Forgetting
-
- Re-encoding when copy would do. Trimming or remuxing with default settings re-encodes
unnecessarily — slower and lossy. Use
-c copywhen not changing the streams.
- Re-encoding when copy would do. Trimming or remuxing with default settings re-encodes
unnecessarily — slower and lossy. Use
-
-ssplacement confusion. Before-i: fast but keyframe-limited (cuts snap to keyframes). After-i: frame-accurate but slower. For precise cuts, put it after.
-
- No
faststartfor web. Without-movflags +faststart, MP4s must fully download before playback starts. Always include it for web delivery.
- No
-
- Overwriting originals. Running conversions in-place or with
-yin a loop over the source folder. Output to a separate directory, verify, then clean up.
- Overwriting originals. Running conversions in-place or with
-
- Ignoring pixel formats. Some players choke on
yuv444pfrom x264 defaults with certain inputs — add-pix_fmt yuv420pfor maximum compatibility.
- Ignoring pixel formats. Some players choke on