FFmpeg Command Builder
Pick the job — convert, extract audio, scale, trim, GIF, compress or strip metadata — and copy the ffmpeg command; nothing is transcoded on this page.
ffmpeg \ -i input.mp4 \ -c copy \ output.mkv
6 arguments
Up to 1024 characters per path · 32768 per command.
Nothing is encoded here. This page writes a command; the ffmpeg you installed does the work.
Code N_COPY_IGNORES_CRFThe video stream rides through bit-for-bit under a codec of copy — nothing is re-encoded, so quality controls such as -crf do not apply. Use the compress task to change quality.
One entry per flag in the command above, in reading order. Every line is this page's own summary and links to the ffmpeg documentation section it was checked against.
ffmpegThe program word. Options before an -i apply to that input; the rest shape the output, which is named last. ffmpeg docs-iReads the file that follows as an input. A command can take several. ffmpeg docs-c copyCopies every stream into the new container without decoding — a remux: seconds of work, no quality change. ffmpeg docsoutputThe file ffmpeg writes. It comes last, and its extension picks the container. ffmpeg docs
These commands are derived from the ffmpeg documentation. They were not executed on the machine that generated this page's goldens.
No file is opened, read or uploaded by this page — a path here is only text inside the command.
Press ? for shortcuts
How to use it
- Choose a task card. The options area shows just what that job needs, and the command rewrites itself as you change anything.
- Enter the input and output paths — up to 1,024 characters each. Stream addresses (http, rtmp, srt and friends) are refused: a stream URL can carry a key a shared link would expose.
- Set the task's options — codecs, times, sizes or a CRF — and pick what happens when the output already exists.
- Copy the command or download it as .sh, then paste it into the terminal on the machine that holds the media. Nothing executes here.
Pick one of seven jobs — convert, extract audio, scale, trim, GIF, compress or strip metadata — fill in two file paths, and the matching ffmpeg command appears, quoted for POSIX shells. Each flag carries a one-line explanation linking to the ffmpeg documentation section it was checked against. Nothing runs and nothing is uploaded here: you copy the command, and the ffmpeg on your own machine does the work.
Examples
Remux MP4 to MKV · -c copyffmpeg -i lecture.mp4 -c copy lecture.mkvBoth codecs on copy move the streams into the new container untouched — seconds of work, no quality change. The .mkv extension picks the muxer.
Extract the audio track · -vnffmpeg -i interview.mp4 -vn -c:a copy interview.m4a-vn drops the video and -c:a copy keeps the sound bit-for-bit. Copying into .m4a assumes an AAC source, as in most MP4s — otherwise pick an encoder.
Scale to 1280 wide · scale=1280:-2ffmpeg -i screen-capture.mov -vf scale=1280:-2 screen-720.mp4-2 computes the height from the aspect ratio and rounds it even, which the default H.264 pixel format requires. A filter always re-encodes — no -c copy here.
Trim 1:30–2:00 · stream copyffmpeg -ss 1:30 -i keynote.mp4 -t 30 -c copy clip.mp4Seeking sits before -i, so the end becomes -t 30 — a duration, because the clock restarts at the seek point. -c copy also snaps the cut to a keyframe.
GIF from a spaced path (edge case)ffmpeg \
-i '/Volumes/My Drive/clip 1.mp4' \
-vf 'fps=12,scale=480:-2:flags=lanczos,palettegen' \
out.palette.png
ffmpeg \
-i '/Volumes/My Drive/clip 1.mp4' \
-i out.palette.png \
-filter_complex 'fps=12,scale=480:-2:flags=lanczos[x];[x][1:v]paletteuse=dither=sierra2_4a' \
-loop 0 \
out.gifTwo commands, run in order: palettegen writes out.palette.png and paletteuse reads it as a second input. The spaced path stays one argument because the word is single-quoted.
Compress · CRF 23 · O'Brien.movffmpeg -i 'O'\''Brien interview.mov' -c:v libx264 -crf 23 -preset medium -c:a copy obrien-small.mp4The apostrophe closes the quote, escapes itself and reopens — '\'' — the one spelling sh, bash and zsh agree on. 23 is libx264's default, not a recommendation.
Every example on this page is executed against the same engine that powers the tool, on every build.
Gotchas worth knowing
-ss before or after -i are different trims
Before -i, ffmpeg jumps the input to the nearest seek point — fast, and a re-encode still cuts exactly, because the frames up to your start are decoded and discarded. After -i, it reads from the top and trims on the output clock. Seek first and the end becomes a -t duration: the timestamps restart, so an absolute -to would land in the wrong place.
A stream-copy cut lands on a keyframe
-c copy cannot split a frame that depends on earlier ones, so the cut snaps to the last keyframe before your start — the clip can open early or run long. Re-encode sits next to it in the card for when the boundary must be exact.
scale's -2 keeps a side even on purpose
-1 preserves the aspect ratio exactly and can land on an odd pixel count — which yuv420p, H.264's default pixel format, refuses. -2 does the same arithmetic rounded to even, so the command works on the first try.
What this page will not do
It never transcodes, previews or uploads media — it is not a video converter, and no in-browser build of ffmpeg is downloaded or run. It does not read ffprobe output, explain a pasted command, drive hardware encoders such as videotoolbox, nvenc or qsv, or write streaming outputs. Quoting targets POSIX sh, bash and zsh; PowerShell and cmd.exe differ.
Common errors
The input path starts with rtmp: — this builder writes commands for local files only, because a stream address can carry a stream key that would ride a shared link. Save the media to disk first, then point ffmpeg at that file.- Usually a paste from a streaming dashboard. The key is a credential — record or download the media, then build against the file.
The input path contains a control character (U+000A) at position 8 — a pasted command carrying it could split or rewrite itself in the terminal. Remove that character: holiday�reel.mp4- A path copied from a chat or an editor can drag an invisible line break along. The message names the character and its position.
The start time "1:75" is not a timecode this builder reads — write seconds (90 or 90.5) or a clock time (1:30 or 00:01:30.250), with minutes and seconds under 60.- Minutes and seconds run 0–59 in clock forms. Plain seconds need no colon: 95 is a valid start time.
The end time (90s) is not after the start time (120s) — nothing would be left between them. Swap them, or raise the end time.- Both times are read into seconds first, so 1:30 against 2:00 compares as 90 against 120.
"60" is not a CRF this builder writes for libx264 — enter a whole number from 0 to 51. 23 is that encoder's own default.- The band and default come from the constants the command writer uses, so the message cannot drift from what is enforced.
The aac encoder writes .m4a here — the output path ends ".mp3". End the path in .m4a, or pick the codec that matches it.- An .mp3 cannot hold AAC audio. Match the extension to the encoder, or pick libmp3lame for a real MP3.
FAQ
Does this page run ffmpeg or read my files?
No. It writes text. The paths you type are quoted into a command and never opened or uploaded — which is why any path works, even one on a machine this browser has never seen. Only the terminal you paste into runs anything.
Why does the GIF task print two commands?
A GIF frame holds at most 256 colours, and a one-pass encode picks them frame by frame, so gradients band. The first command scans the whole clip and writes one palette; the second maps every frame through it. Run them in order — the second reads the file the first wrote.
Which CRF number should I pick?
There is no one right number — CRF trades size against quality, per encoder. libx264 runs 0–51, defaults to 23, with 18–28 the commonly used band; libx265 defaults to 28 and its values are not comparable. Encode a short sample at two or three values and let your eyes decide.
Keyboard shortcuts
- ⌘/Ctrl + C
- Copy the command with nothing selected.
- ⌘/Ctrl + Shift + C
- Copy the command.
- t
- Cycle the theme.
- ? or ⌘/Ctrl + /
- Open the keyboard shortcuts overlay.
- Esc
- Close the dialog.