Home › Developer Tools › FFmpeg Command Generator

FFmpeg Command Generator

Choose what you want to do with a video, set a few options and copy a ready-to-run ffmpeg command. Every flag is explained in plain English, and the command is quoted correctly for macOS/Linux, Command Prompt or PowerShell.

Last updated:

Convert options
Lower = better quality, bigger file
General options
Your ffmpeg command

      

What each part does

Advertisement
Advertisement

How to use the FFmpeg Command Generator

  1. Pick a task such as Convert, Trim or Make GIF at the top.
  2. Type your file names. The output name is suggested automatically; edit it to override, or click auto to go back.
  3. Set the options for the task: quality, times, size, format or subtitle style. The command updates instantly.
  4. Read the explanation under the command to understand each flag, and check any warnings.
  5. Copy the command and run it in a terminal opened in the folder that contains your video.

How an ffmpeg command is put together

Every FFmpeg command follows the same order: ffmpeg [global options] [input options] -i input [output options] output. Position matters. An option placed before -i changes how the input is read (for example -ss before -i seeks quickly to a time), while the same option after -i applies to the output. Options after the last -i describe the file you are creating: which streams to keep (-map), how to encode them (-c:v, -c:a), and which filters to apply (-vf for video, -af for audio).

The choice between re-encoding and stream copy decides speed and quality. -c copy copies the compressed data untouched: it finishes in seconds and loses nothing, but it cannot resize, filter, cut between keyframes or change codecs. Anything that changes the picture or sound needs a real encoder such as libx264 or aac.

FFmpeg options cheat sheet

OptionWhat it doesExample
-iInput file (repeat for several inputs, numbered from 0)-i video.mp4 -i music.mp3
-ss / -t / -toStart time / duration / end time-ss 00:01:00 -t 30
-c:v / -c:aVideo / audio codec, or copy-c:v libx264 -c:a aac
-crfConstant quality target (lower is better)-crf 23
-presetEncoding speed vs. compression efficiency-preset slow
-b:v / -b:aVideo / audio bitrate-b:v 2500k -b:a 128k
-vfVideo filter chain, comma-separated-vf scale=-2:720,fps=30
-an / -vn / -snDrop audio / video / subtitles-an
-mapChoose which input streams go into the output-map 0:v -map 1:a
-rOutput frame rate-r 30
-ar / -acAudio sample rate / channel count-ar 48000 -ac 2
-movflags +faststartWeb-optimized MP4 that starts playing before it fully downloads

Tips for running the commands

  • Inspect the file first with ffprobe -hide_banner input.mp4. It lists the duration, resolution, frame rate and the codec of every stream, which tells you whether a stream copy will work.
  • Test on a short piece by adding -t 10 after the input. Encoding ten seconds shows you the quality and speed before you commit to a two-hour file.
  • Quote names with spaces. The generator does this for you, using double quotes. On macOS and Linux a $ or backtick in a file name is escaped too.
  • Batch-convert a folder in bash with for f in *.mov; do ffmpeg -i "$f" -c:v libx264 -crf 23 "${f%.mov}.mp4"; done, or in PowerShell with Get-ChildItem *.mov | ForEach-Object { ffmpeg -i $_.Name -crf 23 ($_.BaseName + ".mp4") }.
  • Hardware encoders such as h264_nvenc (NVIDIA), h264_qsv (Intel) and h264_videotoolbox (Mac) are much faster but use different quality options than -crf. The commands here use the software encoders, which work on every computer.

Frequently asked questions

Does this tool run FFmpeg or upload my video?

No. It only builds the text of the command in your browser. You run the command yourself with FFmpeg installed on your own computer, so your files never leave it.

What CRF value should I use?

For H.264 (libx264), 23 is the default, 18 looks visually lossless to most viewers and 28 gives much smaller files with some softness. H.265 (libx265) defaults to 28 and gives roughly the same quality as x264 at about 23. For VP9, values around 31 are typical for 1080p. Each increase of about 6 roughly halves the file size.

Why does my trimmed clip start a little early or with a frozen frame?

With stream copy (-c copy) FFmpeg can only cut on keyframes, which may be several seconds apart, so the clip starts at the keyframe before your start time. Choose the frame-accurate method to re-encode the clip and start exactly where you asked.

How is the bitrate for a target file size calculated?

Video bitrate in kbps = target size in MB × 8,388.608 ÷ duration in seconds, minus the audio bitrate. The generator also subtracts 3% for container overhead. Two-pass encoding then distributes those bits across the video so the result lands close to the target.

Why use palettegen and paletteuse for GIFs?

A GIF can only show 256 colors per frame. By default FFmpeg uses a generic palette, which causes banding and grain. palettegen analyses your clip and picks the best 256 colors, and paletteuse maps each frame onto them with dithering, giving much cleaner GIFs.

What is the difference between burned-in and soft subtitles?

Burned-in (hard) subtitles are drawn into the picture, so they show on every player but cannot be turned off and require re-encoding. Soft subtitles are stored as a separate track that viewers can switch on or off; adding them is instant because the video is copied, not re-encoded.

How do I install FFmpeg?

On macOS install it with Homebrew (brew install ffmpeg). On Ubuntu or Debian run sudo apt install ffmpeg. On Windows install it with winget install Gyan.FFmpeg (or download a build from ffmpeg.org) and make sure the bin folder is on your PATH. Check the installation with ffmpeg -version.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Cron Expression GeneratorBuild crontab schedules visually, read them in plain English and see the next run times.Chmod CalculatorConvert Linux file permissions between checkboxes, octal (755) and symbolic (rwxr-xr-x) notation.Dockerfile GeneratorGenerate a production Dockerfile and .dockerignore for Node, Python, Go or a static nginx site.cURL to Code ConverterConvert curl commands to JavaScript fetch, Axios, Python requests, Node.js, PHP and Go code.QR Code GeneratorMake QR codes for links, Wi-Fi, email and more.Barcode GeneratorCreate Code 128, EAN-13, UPC-A, EAN-8, Code 39 and ITF-14 barcodes as PNG or SVG.UUID GeneratorGenerate UUID v4 and v7 / GUIDs in bulk and copy or download them.Schema Markup Generator (JSON-LD)Create JSON-LD structured data for FAQ, Product, Article and more.Htaccess & Nginx Redirect GeneratorBuild 301 redirects for .htaccess, Nginx and Netlify or Cloudflare _redirects.Fake Data GeneratorGenerate mock data as JSON, CSV or SQL.Random String GeneratorGenerate secure random strings and tokens in bulk with any length and character set.API Key GeneratorCreate secure API keys and secrets with prefixes, checksums and SHA-256 hashes for storage.MIME Type LookupFind the MIME type for any file extension, or the extensions for a MIME type, in 400+ entries.URL Slug GeneratorTurn titles into clean, SEO-friendly URL slugs: accents, stop words, separators and bulk lines.JSON Schema GeneratorTurn sample JSON into a draft 2020-12 JSON Schema with types, required fields and formats.Gitignore GeneratorBuild a .gitignore from 50+ templates for languages, frameworks, IDEs and OS, merged and deduped.License GeneratorCreate a LICENSE file for MIT, Apache, GPL, BSD, ISC, MPL or Unlicense with your name and year.ULID GeneratorGenerate sortable ULIDs and UUID v7 in bulk, monotonic option, and decode their timestamps.Htpasswd GeneratorCreate .htpasswd entries with bcrypt, APR1-MD5 or SHA-1 for Apache and Nginx basic auth.Placeholder Image GeneratorCreate placeholder images in any size, color and text as PNG, JPG, WebP, SVG or data URI.Ads.txt GeneratorCreate or validate ads.txt and app-ads.txt files: seller lines, cert IDs and variables.Docker Run to Compose ConverterConvert docker run commands to docker-compose.yml, or a compose file back to docker run.HTML Boilerplate GeneratorTick the options you need and get a clean HTML5 starter template with meta, OG tags and CSS reset.JSON to Zod SchemaInfer a Zod (or Yup) schema from sample JSON with optional, nullable and z.infer types.Linux Commands Cheat SheetSearchable Linux and bash command reference with flags explained, examples and copy buttons.LLMs.txt GeneratorBuild an llms.txt file for AI crawlers: summary and link sections, import from your sitemap.Nano ID GeneratorGenerate secure Nano IDs with custom alphabet, length and count, plus a collision calculator.Nginx Config GeneratorBuild an nginx server block: static site, SPA, reverse proxy or PHP, with SSL, gzip and redirects.OpenAPI / Swagger ViewerView OpenAPI 2/3 JSON or YAML as interactive API docs with validation and an endpoint list.package.json GeneratorFill a form and get a valid, npm-ready package.json with scripts, dependencies and checks.PKCE Code Challenge GeneratorGenerate an OAuth 2.0 PKCE code_verifier and S256 code_challenge, build auth URLs, verify pairs.README GeneratorFill in a form and get a polished README.md with badges, install, usage and license, live preview.Regex GeneratorBuild regular expressions visually from blocks or presets (email, date, phone) and test them live.Commit Message GeneratorBuild Conventional Commit messages with type, scope, body, breaking change and issue refs.Database Schema DesignerDesign tables and relationships visually, then export SQL for MySQL, PostgreSQL or SQLite.Docker Compose GeneratorBuild a docker-compose.yml with a form: services, ports, volumes, env, healthchecks and presets.Dummy File GeneratorCreate test files of an exact size in KB, MB or GB with zeros, random bytes or text.Folder Tree GeneratorTurn a local folder or an indented list into an ASCII directory tree for your README.Product Schema GeneratorBuild Product JSON-LD with price, availability, brand, GTIN, ratings and reviews.Question Keyword GeneratorFind the questions people ask about a topic, grouped by who, what, why, how, can and more.Recipe Schema GeneratorCreate Recipe JSON-LD with ingredients, steps, prep and cook times, nutrition and ratings.Security Headers GeneratorPick HSTS, CSP, frame, referrer and permissions options and get Apache, Nginx, Netlify or Cloudflare config.SKU GeneratorBuild consistent SKUs from brand, category, size and color, then export every variant as CSV.Typography Scale GeneratorBuild a modular type scale from a base size and ratio, then copy CSS variables or a Tailwind config.WordPress Salt GeneratorGenerate fresh WordPress security keys and salts for wp-config.php, .env or Docker in one click.ANSI Color Code GeneratorStyle terminal text with 16, 256 or RGB colors and get escape codes for bash, Python, JS and C.Apache Virtual Host GeneratorCreate an Apache VirtualHost config with SSL, redirects, reverse proxy or PHP-FPM in seconds.Bash Prompt GeneratorDrag and drop a custom PS1 prompt for bash or zsh with colors, git branch and a live preview.Changelog GeneratorTurn Conventional Commit messages into a grouped Keep a Changelog Markdown file per version.cURL Command BuilderBuild curl commands from a form: method, headers, query, JSON or form body, auth and flags.Docker Compose to KubernetesConvert docker-compose.yml into Kubernetes Deployment, Service, ConfigMap and PVC manifests.Docker Compose ValidatorCheck a docker-compose.yml for YAML errors, schema mistakes, broken references and deprecated keys.Dockerfile LinterLint a Dockerfile for best practices: pinned tags, apt cleanup, non-root USER and layer count.Dockerignore GeneratorBuild a .dockerignore from Node, Python, Go and Java templates, plus your own entries.ESLint Config GeneratorGenerate a flat eslint.config.js for JavaScript, TypeScript, React or Node with rule presets.Git Branch Name GeneratorTurn a ticket ID and title into a clean, valid git branch name like feature/PROJ-12-add-login.GitLab CI Config GeneratorGenerate a .gitlab-ci.yml with stages, jobs, images, cache, artifacts and rules from templates.Jinja2 Template TesterRender Jinja2 templates with YAML or JSON variables using real Jinja2, with clear error lines.JSON Schema Mock Data GeneratorGenerate realistic sample JSON from a JSON Schema: formats, patterns, $ref, seeds and counts.Kubernetes Secret GeneratorCreate Kubernetes Secret YAML from key/value pairs or .env with auto base64, or decode one.Kubernetes YAML ValidatorValidate Kubernetes manifests against the API schema of a chosen version, with error paths.Prettier Config GeneratorToggle Prettier options, preview formatted code live and copy your .prettierrc file.Quartz Cron GeneratorBuild and explain Quartz and Spring cron expressions with seconds, ?, L, W and #, plus next fire times.README Badge GeneratorCreate Shields.io-style README badges for license, version, build and custom labels.Systemd Service File GeneratorCreate a systemd .service unit with ExecStart, user, restart policy, environment and hardening.tsconfig.json GeneratorBuild a tsconfig.json with target, module, strict checks and path aliases, each option explained.Access Log AnalyzerAnalyze Apache and Nginx access logs: top URLs, IPs, status codes, bots and traffic charts.Regex String GeneratorGenerate random test strings that match any regular expression, checked against the real regex.
See all 85 Code Generators & Builders →