FFmpeg commands follow a positional pattern: ffmpeg [global options] {[input options] -i input} ... {[output options] output} .... In practice, place -i before each input, put output settings before the output filename, and remember that an option generally applies to the next input or output file. This guide explains ten high-value options you can adapt safely, with examples for conversion, stream selection, duration limits and overwrite behavior.
How an FFmpeg command is assembled
FFmpeg describes itself as “a universal media converter.” A basic command has the program name, optional global settings, one or more inputs, and one or more outputs:
ffmpeg [global_options] {[input_file_options] -i input_url} ... {[output_file_options] output_url} ...
For a simple conversion, the input is introduced with -i and the output normally comes last:
ffmpeg -i input.avi output.mp4
FFmpeg usually detects an input format and infers an output format from the filename extension. You can force a format with -f when inference is unavailable or unsuitable. Option placement is significant: settings are associated with the next specified input or output and reset between files. The examples below follow the current official manual at ffmpeg.org/ffmpeg.html; that documentation is regenerated nightly, and FFmpeg remains under continuous development.
#1 Best Overall
1. -i: specify an input
-i introduces an input file, URL or device. It must appear before the input it describes.
ffmpeg -i input.mp4 output.webm
This asks FFmpeg to read input.mp4 and write output.webm. The command alone does not promise a particular codec, quality or size: defaults and container compatibility determine the actual result. With multiple inputs, repeat the option:
ffmpeg -i video.mp4 -i commentary.wav output.mkv
Input-specific options belong before the corresponding -i. If an option is put after the input, it may instead be interpreted as an output option.
2. -c, -c:v and -c:a: encode or copy streams
The codec option selects an encoder for an output or a decoder for an input. Stream specifiers narrow it to a media type: -c:v targets video and -c:a targets audio. The special value copy requests stream copy, so that stream is not re-encoded.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsffmpeg -i INPUT -map 0 -c:v libx264 -c:a copy OUTPUT
Here every stream selected by -map 0 is considered; video is encoded with libx264, while audio is copied. Encoding can change quality and requires processing. Copying avoids re-encoding, but the destination container must support the source codec and stream parameters. If it does not, choose a compatible encoder instead.
ffmpeg -i input.mov -c:v libx264 -c:a aac output.mp4
Use an explicit codec when predictable compatibility matters, rather than assuming the extension determines every codec choice.
3. -map: choose exactly which streams go out
Without -map, FFmpeg automatically selects streams. Manual mapping is more predictable when a file contains several video, audio, subtitle or data tracks.
ffmpeg -i INPUT -map 0:v -map 0:a? OUTPUT
0:v means video streams from the first input. 0:a? means audio streams from that input, with the question mark making the audio selection optional if none exists. Without the question mark, a missing requested stream can make the command fail.
Recommended Free Tools
Mapping changes what is included; it can replace the defaults rather than merely adding another stream. To select a particular audio track, use a stream index such as -map 0:a:1. Inspect the input first with:
ffmpeg -i input.mkv
FFmpeg prints the available streams before asking for an output, allowing you to identify indexes and codecs.
4. -f: force a format
FFmpeg generally detects input formats and guesses an output format from its extension, so routine named files rarely need -f. It is useful for raw media, pipes, protocol inputs or a filename whose extension does not describe the intended format.
ffmpeg -f lavfi -i testsrc=size=1280x720:rate=30 -t 5 test.mp4
Forcing a format does not select a suitable codec automatically. The muxer, codecs and stream settings must still be compatible.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
5. -t: limit how much media is processed
As an output option, -t stops writing after the requested duration:
ffmpeg -i input.mp4 -t 00:00:10 output.mp4
Placed before -i, it limits how much of that input is read:
Rank #3
ffmpeg -t 00:00:10 -i input.mp4 output.mp4
Those placements can produce different processing behavior, especially with multiple inputs. The manual also documents -to as an alternative stopping point; -t and -to are mutually exclusive, and -t takes priority if both are supplied.
6. -b:v: set a target video bitrate
-b:v sets the target bitrate for encoded video. The official manual gives this syntax:
ffmpeg -i input.avi -b:v 64k -bufsize 64k output.mp4
A bitrate is not a direct quality guarantee. Perceived quality and final size also depend on the codec, rate-control mode, motion and detail in the source, frame rate and other encoder settings. Treat the documented command as a demonstration of placement and units, not a universal recommendation for every video.
7. -r: set the output frame rate
As an output option, -r requests a frame rate for the generated output:
ffmpeg -i input.avi -r 24 output.mp4
Changing frame rate can duplicate or drop frames and may affect motion and audio synchronization. Do it when the delivery specification requires a particular rate, not merely because a number looks preferable. FFmpeg also has an input frame-rate option, documented as valid for raw formats; do not use input-side frame-rate forcing as a general fix for ordinary camera files.
8. -y: overwrite without asking
-y is a global option that overwrites an existing output file without prompting.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteffmpeg -y -i input.mp4 output.mp4
It is convenient in unattended scripts, but a typo in the output path can replace a file immediately. Use it only when that behavior is intentional.
9. -n: never overwrite
-n is the safer counterpart. If the output already exists, FFmpeg refuses to overwrite it and exits.
ffmpeg -n -i input.mp4 output.mp4
Do not combine -y and -n to express a preference: they represent opposing policies. In batch jobs, handle the nonzero exit status and choose a new filename or an explicit replacement step.
10. -vn and the stream-exclusion family
-vn excludes video from an output. Related options are -an for audio, -sn for subtitles and -dn for data. They are useful when automatic selection or mapping would otherwise include an unwanted stream.
Free tools Windows power users keep installed
One-click scans. No signup required.
ffmpeg -i video.mp4 -vn output.m4a
This example asks for an audio-only output, but the destination container and audio codec must support the selected stream. If the source audio is not suitable for the target container, add an audio codec:
ffmpeg -i video.mp4 -vn -c:a aac output.m4a
Filtergraph outputs can have their own behavior, so stream-exclusion flags are not a substitute for understanding a complex filtergraph.
Choosing between common alternatives
| Decision | Use this when | Important limitation |
|---|---|---|
Encode versus copy |
You need a different codec or compatible delivery format; use copy when the existing stream is acceptable. |
Copying is fast and lossless for the stream, but the target container must support it. |
Automatic selection versus -map |
Automatic selection is fine for simple files; mapping is preferable with multiple tracks or a required track. | Manual mapping can omit streams unless you map them explicitly. |
Filename inference versus -f |
Use extension inference for normal files. | Force a format for raw, piped or ambiguous inputs; format alone does not choose codecs. |
-y versus -n |
-y deliberately replaces files; -n protects existing files. |
Both are global overwrite policies, so select one deliberately. |
-t versus -to |
Use -t for a duration limit. |
The options are mutually exclusive and -t takes priority. |
A practical workflow for adapting a command
- Inspect the source. Run
ffmpeg -i sourceand note stream indexes, codecs, duration and metadata. - Decide whether to copy or encode. Copy only when the destination container accepts the streams; otherwise set
-c:vand/or-c:a. - Choose streams. Start with automatic selection for a simple file. Add
-mapwhen multiple tracks make the choice ambiguous. - Place options correctly. Put input options before their
-i; put output options before the corresponding output filename. - Protect the destination. Use
-nduring experimentation and reserve-yfor controlled automation. - Test a short segment. Add output-side
-twhile checking codecs, sync and container playback, then remove it for the full run.
Troubleshooting common failures
“Unable to find a suitable output format”
The filename extension may be missing or unsupported. Give the output a recognized extension or specify the intended muxer with -f.
“Stream mapping …” errors
Your map may request a stream that does not exist. Inspect the input listing, correct the index, or use ? for an optional stream such as -map 0:a?.
“Could not write header” or codec/container errors
The selected stream codec may not be accepted by the destination container. Replace copy with a compatible encoder, or choose another container.
The output is unexpectedly long or short
Check where -t appears. Before -i it limits input reading; after the input it limits output writing. Also ensure you did not use -to with -t.
Existing output was replaced or the command stopped
Review overwrite policy. -y replaces without prompting; -n exits when the file exists. Remove the unwanted flag and select a new destination if necessary.
No audio or video appears
Look for -vn, -an or an incomplete -map. These options intentionally exclude stream types or replace automatic selection.
Or skip the browser setup
If your project also needs repeatable screenshots of web pages, ScreenshotNeo provides a one-call website screenshot API rather than requiring you to maintain a browser script:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the complete request options in the ScreenshotNeo documentation. Before capture it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server includes take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
Keeping commands maintainable
- Quote paths and URLs containing spaces or shell metacharacters.
- Use explicit stream specifiers when a file’s track layout can change.
- Keep a protected output directory and use
-nwhile developing scripts. - Record the FFmpeg command and version alongside generated media because the documentation is regenerated nightly and behavior can change.
- Validate the finished file in the players and platforms that will actually receive it.
Frequently Asked Questions
Are these ten options the only FFmpeg options worth learning?
No. They are a practical beginner selection for input and output placement, codecs, stream choice, duration, frame rate, format and overwrite safety. FFmpeg has many additional filters, protocols and codec-specific settings.
Why does the same option behave differently in another command?
FFmpeg options are positional. An option generally applies to the next input or output file, so moving it across an -i or output filename can change its scope.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Where should I check syntax changes?
Use the current official manual at ffmpeg.org/ffmpeg.html; FFmpeg’s documentation index says its pages are regenerated nightly for the newest revision.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

