{"course":{"slug":"video-editing","title":"Editing Video","url":"https://addaly.com/learn/video-editing","level":"beginner","track":"create"},"lesson":{"slug":"ffmpeg-for-editors","title":"Six ffmpeg commands worth knowing","url":"https://addaly.com/learn/video-editing/ffmpeg-for-editors","position":73,"of":77,"minutes":10,"answer":"ffmpeg never modifies its input, so inspecting, remuxing, converting a variable frame rate recording and measuring the loudness of a finished file are all free experiments.","keyIdea":"ffmpeg never modifies its input, so inspecting, remuxing, converting a variable frame rate recording and measuring the loudness of a finished file are all free experiments."},"body":{"format":"markdown","text":"## The tool that does the jobs your editor refuses\n\nffmpeg is a free command-line program that reads and writes essentially every video and audio format there is. Every editor you have used has some version of it, or something like it, buried inside. Learning six commands from it removes a whole class of problem from your week: the file that will not import, the client who needs it 4 MB smaller, the screen recording that drifts out of sync, the codec your free editor declines to write.\n\nInstall it with `brew install ffmpeg` on macOS, `sudo apt install ffmpeg` on Debian or Ubuntu, `winget install ffmpeg` on Windows, or from the official downloads page. It has no interface. That is the point: it does one job per line and leaves the machine free.\n\nThe general shape is always the same:\n\n```bash\nffmpeg -i input.mov  [what to do]  output.mp4\n```\n\nInput first, options, output last. The last filename is always the one being written, and ffmpeg will ask before overwriting.\n\n## 1. Find out what a file actually is\n\n```bash\nffprobe -hide_banner clip.mp4\n```\n\nThe two lines beginning `Stream #0:0` and `Stream #0:1` tell you codec, resolution, frame rate, pixel format and audio sample rate. When somebody says \"it won't import\", this is the first thing to run, and it is usually the whole diagnosis. For a tidier answer:\n\n```bash\nffprobe -v error -select_streams v:0 \\\n  -show_entries stream=codec_name,width,height,r_frame_rate,pix_fmt \\\n  -of default=noprint_wrappers=1 clip.mp4\n```\n\n## 2. Change the box without touching the picture\n\n```bash\nffmpeg -i clip.mkv -c copy clip.mp4\n```\n\nSeconds, not minutes, and no quality loss at all, because nothing is decoded. Covered in the container lesson; it belongs on this list because it is the command you will use most.\n\n## 3. Re-encode to a specific quality\n\n```bash\nffmpeg -i master.mov -c:v libx264 -crf 20 -preset slow \\\n  -pix_fmt yuv420p -c:a aac -b:a 192k out.mp4\n```\n\n`-crf 20` is the quality dial: lower is better, 18 is near-transparent, 23 is the default. `-preset slow` trades encoding time for a smaller file at the same quality.\n\n`-pix_fmt yuv420p` is the single most useful flag on this page. A file encoded as `yuv444p` or `yuv422p` plays perfectly in VLC and refuses to play in QuickTime, Safari and most browsers. When a file works on your machine and not on the client's, check the pixel format first.\n\n## 4. Trim without re-encoding\n\n```bash\nffmpeg -ss 00:01:30 -i in.mp4 -t 60 -c copy out.mp4\n```\n\nStart at one minute thirty, take sixty seconds, copy the streams. Instant, lossless, and **it will not land on the exact frame you asked for**. With `-c copy` the cut must begin on a keyframe, and keyframes in a long-GOP file are typically one or two seconds apart, so the start can move by up to that much. For a rough extract this is fine. For a frame-accurate cut, drop `-c copy` and let it re-encode.\n\n## 5. Fix a variable frame rate recording\n\nScreen recorders and phones often write **variable frame rate** files: 30 fps when the screen is still, 12 fps when nothing moves. Editors assume a constant rate, so the audio holds and the picture drifts, and by minute eight the lips are a third of a second late.\n\n```bash\nffmpeg -i screen.mp4 -vf \"fps=30\" -c:v libx264 -crf 18 \\\n  -c:a copy fixed.mp4\n```\n\nDo this before importing, every time, for anything that came from a screen recorder, a phone screen capture or a game capture tool. The setup block warned about drift; this is the command that cures it.\n\n## 6. Measure loudness on the exported file\n\n```bash\nffmpeg -i final.mp4 -af loudnorm=print_format=summary -f null -\n```\n\nIt prints integrated loudness, loudness range and true peak for the actual delivered file rather than for your timeline. The sound block covered what the numbers mean. This is how you check them on the thing you are about to send, which is the only place the check counts.\n\n## Two more worth keeping\n\nExtract the audio for a transcription service, or for a sound editor:\n\n```bash\nffmpeg -i film.mov -vn -c:a pcm_s24le audio.wav\n```\n\nMake a contact-sheet-style still every ten seconds, for logging or for thumbnails:\n\n```bash\nffmpeg -i film.mov -vf \"fps=1/10\" stills/frame_%04d.jpg\n```\n\n## How to be safe with it\n\nffmpeg never modifies its input. Everything it does produces a new file, so the worst outcome of a wrong command is a wasted file and a wasted minute. That makes it a good place to experiment.\n\nTwo habits keep it painless. Work in the folder the files are in, so filenames stay short. And when a command fails, read the **last three lines** of the output rather than scrolling back through the banner: the actual error is nearly always there, and it nearly always names the stream it could not handle.\n\n## Honest limits\n\nffmpeg is not an editor and this is not a route around learning one. It has no timeline, no scopes and no sense of what a cut is. Its filter syntax is awkward, the documentation is written for people who already understand it, and half the answers you will find online are for versions from a decade ago. Use it for the six jobs above and reach for the editor for everything else.\n\n## Today\n\nRun `ffprobe` on the last file a client sent you. Then remux it to MP4 with `-c copy` and time how long it takes."},"check":{"question":"A trim with `-ss 00:01:30 -t 60 -c copy` produces a file that starts about a second later than asked. Why?","options":[{"text":"With the streams copied rather than re-encoded, the cut can only start on a keyframe, which may be a second or two away.","correct":true},{"text":"Placing `-ss` before `-i` performs an approximate seek, and moving it after the input would make the copy frame-accurate.","correct":false,"tempting":"The position of `-ss` does change seeking behaviour, but with `-c copy` the keyframe constraint still applies wherever you put it; only dropping `-c copy` gives frame accuracy."},{"text":"Copying streams discards the source timecode track, so the output is timed from the file's own first frame instead of from the requested point.","correct":false,"tempting":"Invents a timecode mechanism; the offset comes from the structure of the compressed frames, and the same shift happens in files carrying no timecode at all."},{"text":"The container rounds start times to whole seconds whenever no re-encode takes place, so any fractional start position is discarded.","correct":false,"tempting":"Proposes a rounding rule that does not exist; the shift is to the nearest keyframe, which rarely falls on a whole second."}]},"prev":{"slug":"export-settings-per-destination","title":"The numbers, destination by destination","url":"https://addaly.com/learn/video-editing/export-settings-per-destination"},"next":{"slug":"masters-and-intermediates","title":"The master, and the versions to make while the project is open","url":"https://addaly.com/learn/video-editing/masters-and-intermediates"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Source and assessment review continues. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'Six ffmpeg commands worth knowing', in Editing Video. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/video-editing/ffmpeg-for-editors (Accessed: 29 November 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"Six ffmpeg commands worth knowing","courseTitle":"Editing Video","module":{"index":8,"slug":"delivery","title":"Delivery: the file that leaves the building"},"answer":null,"keyIdea":"ffmpeg never modifies its input, so inspecting, remuxing, converting a variable frame rate recording and measuring the loudness of a finished file are all free experiments.","hero":{"kind":"plate","image":null,"alt":null,"caption":null},"blocks":[{"t":"h2","id":"the-tool-that-does-the-jobs-your-editor-refuses","runs":[{"text":"The tool that does the jobs your editor refuses"}]},{"t":"p","runs":[{"text":"ffmpeg is a free command-line program that reads and writes essentially every video and audio format there is. Every editor you have used has some version of it, or something like it, buried inside. Learning six commands from it removes a whole class of problem from your week: the file that will not import, the client who needs it 4 MB smaller, the screen recording that drifts out of sync, the codec your free editor declines to write."}]},{"t":"p","runs":[{"text":"Install it with "},{"text":"brew install ffmpeg","code":true},{"text":" on macOS, "},{"text":"sudo apt install ffmpeg","code":true},{"text":" on Debian or Ubuntu, "},{"text":"winget install ffmpeg","code":true},{"text":" on Windows, or from the official downloads page. It has no interface. That is the point: it does one job per line and leaves the machine free."}]},{"t":"p","runs":[{"text":"The general shape is always the same:"}]},{"t":"code","lang":"bash","label":"Bash","text":"ffmpeg -i input.mov  [what to do]  output.mp4"},{"t":"p","runs":[{"text":"Input first, options, output last. The last filename is always the one being written, and ffmpeg will ask before overwriting."}]},{"t":"h2","id":"1-find-out-what-a-file-actually-is","runs":[{"text":"1. Find out what a file actually is"}]},{"t":"code","lang":"bash","label":"Bash","text":"ffprobe -hide_banner clip.mp4"},{"t":"p","runs":[{"text":"The two lines beginning "},{"text":"Stream #0:0","code":true},{"text":" and "},{"text":"Stream #0:1","code":true},{"text":" tell you codec, resolution, frame rate, pixel format and audio sample rate. When somebody says “it won’t import”, this is the first thing to run, and it is usually the whole diagnosis. For a tidier answer:"}]},{"t":"code","lang":"bash","label":"Bash","text":"ffprobe -v error -select_streams v:0 \\\n  -show_entries stream=codec_name,width,height,r_frame_rate,pix_fmt \\\n  -of default=noprint_wrappers=1 clip.mp4"},{"t":"h2","id":"2-change-the-box-without-touching-the-picture","runs":[{"text":"2. Change the box without touching the picture"}]},{"t":"code","lang":"bash","label":"Bash","text":"ffmpeg -i clip.mkv -c copy clip.mp4"},{"t":"p","runs":[{"text":"Seconds, not minutes, and no quality loss at all, because nothing is decoded. Covered in the container lesson; it belongs on this list because it is the command you will use most."}]},{"t":"h2","id":"3-re-encode-to-a-specific-quality","runs":[{"text":"3. Re-encode to a specific quality"}]},{"t":"code","lang":"bash","label":"Bash","text":"ffmpeg -i master.mov -c:v libx264 -crf 20 -preset slow \\\n  -pix_fmt yuv420p -c:a aac -b:a 192k out.mp4"},{"t":"p","runs":[{"text":"-crf 20","code":true},{"text":" is the quality dial: lower is better, 18 is near-transparent, 23 is the default. "},{"text":"-preset slow","code":true},{"text":" trades encoding time for a smaller file at the same quality."}]},{"t":"p","runs":[{"text":"-pix_fmt yuv420p","code":true},{"text":" is the single most useful flag on this page. A file encoded as "},{"text":"yuv444p","code":true},{"text":" or "},{"text":"yuv422p","code":true},{"text":" plays perfectly in VLC and refuses to play in QuickTime, Safari and most browsers. When a file works on your machine and not on the client’s, check the pixel format first."}]},{"t":"h2","id":"4-trim-without-re-encoding","runs":[{"text":"4. Trim without re-encoding"}]},{"t":"code","lang":"bash","label":"Bash","text":"ffmpeg -ss 00:01:30 -i in.mp4 -t 60 -c copy out.mp4"},{"t":"p","runs":[{"text":"Start at one minute thirty, take sixty seconds, copy the streams. Instant, lossless, and "},{"text":"it will not land on the exact frame you asked for","b":true},{"text":". With "},{"text":"-c copy","code":true},{"text":" the cut must begin on a keyframe, and keyframes in a long-GOP file are typically one or two seconds apart, so the start can move by up to that much. For a rough extract this is fine. For a frame-accurate cut, drop "},{"text":"-c copy","code":true},{"text":" and let it re-encode."}]},{"t":"h2","id":"5-fix-a-variable-frame-rate-recording","runs":[{"text":"5. Fix a variable frame rate recording"}]},{"t":"p","runs":[{"text":"Screen recorders and phones often write "},{"text":"variable frame rate","b":true},{"text":" files: 30 fps when the screen is still, 12 fps when nothing moves. Editors assume a constant rate, so the audio holds and the picture drifts, and by minute eight the lips are a third of a second late."}]},{"t":"code","lang":"bash","label":"Bash","text":"ffmpeg -i screen.mp4 -vf \"fps=30\" -c:v libx264 -crf 18 \\\n  -c:a copy fixed.mp4"},{"t":"p","runs":[{"text":"Do this before importing, every time, for anything that came from a screen recorder, a phone screen capture or a game capture tool. The setup block warned about drift; this is the command that cures it."}]},{"t":"h2","id":"6-measure-loudness-on-the-exported-file","runs":[{"text":"6. Measure loudness on the exported file"}]},{"t":"code","lang":"bash","label":"Bash","text":"ffmpeg -i final.mp4 -af loudnorm=print_format=summary -f null -"},{"t":"p","runs":[{"text":"It prints integrated loudness, loudness range and true peak for the actual delivered file rather than for your timeline. The sound block covered what the numbers mean. This is how you check them on the thing you are about to send, which is the only place the check counts."}]},{"t":"h2","id":"two-more-worth-keeping","runs":[{"text":"Two more worth keeping"}]},{"t":"p","runs":[{"text":"Extract the audio for a transcription service, or for a sound editor:"}]},{"t":"code","lang":"bash","label":"Bash","text":"ffmpeg -i film.mov -vn -c:a pcm_s24le audio.wav"},{"t":"p","runs":[{"text":"Make a contact-sheet-style still every ten seconds, for logging or for thumbnails:"}]},{"t":"code","lang":"bash","label":"Bash","text":"ffmpeg -i film.mov -vf \"fps=1/10\" stills/frame_%04d.jpg"},{"t":"h2","id":"how-to-be-safe-with-it","runs":[{"text":"How to be safe with it"}]},{"t":"p","runs":[{"text":"ffmpeg never modifies its input. Everything it does produces a new file, so the worst outcome of a wrong command is a wasted file and a wasted minute. That makes it a good place to experiment."}]},{"t":"p","runs":[{"text":"Two habits keep it painless. Work in the folder the files are in, so filenames stay short. And when a command fails, read the "},{"text":"last three lines","b":true},{"text":" of the output rather than scrolling back through the banner: the actual error is nearly always there, and it nearly always names the stream it could not handle."}]},{"t":"h2","id":"honest-limits","runs":[{"text":"Honest limits"}]},{"t":"p","runs":[{"text":"ffmpeg is not an editor and this is not a route around learning one. It has no timeline, no scopes and no sense of what a cut is. Its filter syntax is awkward, the documentation is written for people who already understand it, and half the answers you will find online are for versions from a decade ago. Use it for the six jobs above and reach for the editor for everything else."}]},{"t":"h2","id":"today","runs":[{"text":"Today"}]},{"t":"p","runs":[{"text":"Run "},{"text":"ffprobe","code":true},{"text":" on the last file a client sent you. Then remux it to MP4 with "},{"text":"-c copy","code":true},{"text":" and time how long it takes."}]}],"check":{"question":[{"text":"A trim with "},{"text":"-ss 00:01:30 -t 60 -c copy","code":true},{"text":" produces a file that starts about a second later than asked. Why?"}],"options":[{"text":[{"text":"With the streams copied rather than re-encoded, the cut can only start on a keyframe, which may be a second or two away."}],"correct":true,"tempting":null},{"text":[{"text":"Placing "},{"text":"-ss","code":true},{"text":" before "},{"text":"-i","code":true},{"text":" performs an approximate seek, and moving it after the input would make the copy frame-accurate."}],"correct":false,"tempting":[{"text":"The position of "},{"text":"-ss","code":true},{"text":" does change seeking behaviour, but with "},{"text":"-c copy","code":true},{"text":" the keyframe constraint still applies wherever you put it; only dropping "},{"text":"-c copy","code":true},{"text":" gives frame accuracy."}]},{"text":[{"text":"Copying streams discards the source timecode track, so the output is timed from the file’s own first frame instead of from the requested point."}],"correct":false,"tempting":[{"text":"Invents a timecode mechanism; the offset comes from the structure of the compressed frames, and the same shift happens in files carrying no timecode at all."}]},{"text":[{"text":"The container rounds start times to whole seconds whenever no re-encode takes place, so any fractional start position is discarded."}],"correct":false,"tempting":[{"text":"Proposes a rounding rule that does not exist; the shift is to the nearest keyframe, which rarely falls on a whole second."}]}],"order":[2,1,3,0],"why":null},"prev":{"slug":"export-settings-per-destination","title":"The numbers, destination by destination","minutes":10},"next":{"slug":"masters-and-intermediates","title":"The master, and the versions to make while the project is open","minutes":9}}}