One FFmpeg A Day
Notes on FFmpeg, written by and for people who use it every day.
-
Guide
Convert AVI to MP4 with H.264 and AAC (the broadly compatible combo)
AVI is still common in legacy workflows, surveillance footage, and some scientific capture pipelines. Converting to MP4 with H.264 video and AAC audio gives you a file that plays everywhere, from phones to browsers to TVs, at reasonable size. The command ffmpeg -i input.avi -c:v libx264 -c:
Oct 14, 2026 -
Guide
Remux MP4 to MKV without re-encoding (lossless, instant)
If you only need a different container, do not re-encode. Stream copy moves the encoded audio and video packets from one container into another with no quality loss and finishes in seconds, even on a multi-gigabyte file. The command ffmpeg -i input.mp4 -c copy output.mkv What
Oct 13, 2026 -
Guide
How to read any media file's metadata with FFmpeg
Before you transcode anything, look at what you have. FFmpeg's probe mode is the fastest way to inspect a media file: it reads the container header and stream metadata, prints a full report, and exits. It produces no output file and is read-only, so it is safe
Oct 12, 2026 -
Guide
Force input file format with -f
FFmpeg usually detects the input format from the file header, but there are cases where the detection fails: raw streams, network captures, or files with a missing extension. The `-f` flag before the input forces the demuxer to use a specific format, bypassing the auto-detection. The command ffmpeg -f
Oct 9, 2026 -
Guide
Set keyframe interval manually with -g
The keyframe interval is the distance between I-frames in the encoded video. A smaller interval improves seek performance and recovery from packet loss; a larger interval improves compression efficiency. The default is 250 frames (about 10 seconds at 25 fps), but for web video, a 2-second interval is
Oct 8, 2026 -
Guide
Generate a thumbnail contact sheet
A contact sheet is a single image with a grid of thumbnails from a video. It is the right tool for a quick visual index of a long file, or for a preview that shows the pacing of the content. The `thumbnail` filter in libavfilter picks the most representative frames
Oct 7, 2026 -
Guide
Use the segment muxer to write chunks
The `segment` muxer writes the output as a sequence of files, each containing a fixed duration of the input. It is the right tool for generating chunks for an HLS or DASH playlist, or for breaking a long recording into manageable pieces for a CDN. The command ffmpeg -i in.
Oct 6, 2026 -
Guide
Use tee to write to multiple outputs at once
The `tee` muxer writes the same encoded output to multiple destinations in a single command. It is the right tool for a live stream that needs to go to YouTube and Twitch simultaneously, or a transcoded file that needs to land in two locations. The command ffmpeg -i in.mp4
Oct 5, 2026 -
Guide
Use the concat protocol
The `concat` protocol is the one-line version of the `concat` demuxer. It uses the `concat:` URL scheme to specify the input files, separated by `|`. It is the right tool for a quick join without a list file. The command ffmpeg -i "concat:a.mp4|b.mp4|c.mp4&
Oct 2, 2026 -
Guide
Use the concat demuxer with a list file
When the concatenation order is fixed and the input files all share the same codec and parameters, the `concat` demuxer is the fastest way to join them. It runs at I/O speed, requires no re-encoding, and is driven by a plain-text list file. The command ffmpeg -f
Oct 1, 2026 -
Guide
Use -movflags +faststart for web playback
When an MP4 is encoded normally, the metadata sits at the end of the file. A web player must download the entire file before it can start playing, which is slow for long videos. The `-movflags +faststart` flag moves the metadata to the front of the file during a second
Sep 30, 2026 -
Guide
Force a specific output container
FFmpeg usually picks the output container from the output filename, but it can be told to use a specific muxer with the `-f` flag. This is the right approach when the output is being piped to another process, or when the container name is not in the filename (e.g.
Sep 29, 2026 -
Guide
Cap output file size with -fs
When the target is a file size, not a duration, the `-fs` flag stops the encode as soon as the output reaches the cap. It is most useful for fitting a video into a service that limits upload size (email, chat, social) without computing the bitrate manually. The command ffmpeg
Sep 28, 2026 -
Guide
Limit output duration with -t
The `-t` flag caps the output duration. It works on any input and any output format, and it stops the encode as soon as the limit is reached. The most common use is grabbing the first N seconds of a clip for a preview, a test, or a social-media
Sep 25, 2026 -
Guide
Use -ss after -i for accurate seek
When the cut point must be exact, place `-ss` after the input. FFmpeg will decode from the start of the file (or from the nearest keyframe), then seek to the exact time. The cost is a full decode up to the cut point, but the precision is frame-accurate. The
Sep 24, 2026 -
Guide
Use -ss before -i for fast seek
When you only need a clip from the middle of a long file, the position of `-ss` on the command line changes the cost by orders of magnitude. `-ss` before `-i` triggers a fast keyframe-aligned seek; `-ss` after `-i` triggers an accurate but slow frame-by-frame seek. The
Sep 23, 2026 -
Guide
Stream from a USB microphone
Capturing a USB microphone is a one-line command on Linux (ALSA), macOS (AVFoundation), or Windows (DirectShow). The output is a raw audio file you can use for a podcast, a voiceover, or a live stream. The command ffmpeg -f alsa -ac 2 -ar 48000 -i hw:0,0 -c:
Sep 22, 2026 -
Guide
Stream from a webcam
Capturing a webcam in FFmpeg is the first step in any streaming setup. The command depends on the platform: on Linux, the Video4Linux2 API; on macOS, the AVFoundation framework; on Windows, the DirectShow API. Each one has a different device name format, but the principle is the same. The command
Sep 21, 2026 -
Guide
Crossfade between two audio clips
The `acrossfade` filter is the audio version of `xfade`. It blends two audio streams for a specified duration at a specified offset, so a music track can fade into a voiceover, or two songs can be joined without a hard cut. The command ffmpeg -i music.mp3 -i voice.wav
Sep 18, 2026 -
Guide
Crossfade between two video clips
The `xfade` filter is a one-line dissolve between two videos. It blends the two streams for a specified duration at a specified offset, so a transition can be programmed in the filter graph without an external editor. The filter supports several transition types: fade, wipe, slide, and more. The
Sep 17, 2026 -
Guide
Pad a video with black frames to a target duration
Sometimes you have a clip that is too short for the slot it needs to fill — a 2-second title card that needs to run for 10 seconds, a 30-second bumper that needs to be 1 minute. The `tpad` filter pads the start, end, or both of a video
Sep 16, 2026 -
Guide
Loop a short clip to a target duration
If you have a 30-second bumper and need a 5-minute placeholder, the `stream_loop` flag tells the demuxer to loop the input a fixed number of times. Combined with `-t` to limit the output duration, you get a precise-length file that uses only the source material. The
Sep 15, 2026 -
Guide
Apply a reverb effect
Reverb simulates a space by adding many delayed copies of the audio to the dry signal. A short reverb makes a vocal sit in a small room; a long reverb makes a snare sound like it was recorded in a cathedral. The `aecho` filter is a simple delay-line reverb;
Sep 14, 2026 -
Guide
Apply a chorus effect
The chorus effect thickens a sound by mixing the dry signal with a slightly delayed and detuned copy. It is the effect that makes a clean electric guitar sound wide, and a clean vocal sound like a choir. The `chorus` filter in libavfilter is a multi-voice chorus with adjustable
Sep 11, 2026 -
Guide
Add a click track for a metronome
A click track is a short percussive sound played at a steady tempo. Musicians use it to stay in time, podcasters use it to mark sections, and fitness apps use it to pace a workout. FFmpeg can generate one with a few lines: a sine wave at a fixed frequency,
Sep 10, 2026 -
Guide
Extract the center channel from stereo
Karaoke tracks, vocal-removed versions, and isolation mixes all use the same trick: the lead vocal is usually panned to the center of the stereo image, so subtracting the left channel from the right cancels it. The `pan` filter lets you build a custom channel map; for the center extraction,
Sep 9, 2026 -
Guide
Gate quiet audio below a threshold
A noise gate is the audio equivalent of a mute button that engages when the level drops below a threshold. It silences background noise between spoken phrases, removes room tone from a quiet section, and cleans up the gaps in a music track. The `agate` filter in libavfilter is a
Sep 8, 2026 -
Guide
Tame harsh high frequencies with lowpass
The mirror of the highpass filter, `lowpass` removes everything above a cutoff frequency. It is the right tool for taming sibilance, hiss, and high-frequency noise that survived the denoiser. It is also a quick way to make a recording sound 'warmer' without changing the overall level. The
Sep 7, 2026 -
Guide
Remove low-frequency rumble with highpass
Most recordings have a low-frequency rumble below 80 Hz: HVAC noise, handling noise, mic stand vibrations, wind. The `highpass` filter removes everything below a cutoff frequency, leaving the speech or music intact. It is a one-line fix for the most common audio problem. The command ffmpeg -i in.
Sep 4, 2026 -
Guide
Denoise audio with afftdn
Afftdn is a frequency-domain denoiser for audio. It computes a short-time Fourier transform, identifies the noise floor in each frequency bin, and subtracts it. The result is a clean signal with the speech or music preserved, useful for field recordings, voice memos, and old tapes. The command ffmpeg
Sep 3, 2026 -
Guide
Even out voice levels with acompressor
Voice recordings are rarely at a constant level. The speaker leans in, leans back, gets excited, gets quiet — the result is a file that is hard to listen to at a fixed volume. The `acompressor` filter is a one-knob compressor that smooths the dynamic range in real time, lifting
Sep 2, 2026 -
Guide
Add a test-tone sine wave
A pure sine wave at a known frequency is the simplest possible audio test signal. You use it to verify a speaker is wired correctly (left vs right), to calibrate a room's response, or to confirm an audio interface is passing signal at all. FFmpeg can generate one
Sep 1, 2026 -
Guide
Generate a showcqt spectrogram
Constant-Q transform (CQT) is a variant of the FFT where the frequency bins are spaced logarithmically, matching the way humans perceive pitch. The `showcqt` filter renders a CQT spectrogram as a video, which is the look of audio visualizers and music identification apps. The command ffmpeg -i in.wav
Aug 31, 2026 -
Guide
Generate a spectrum image from audio
A spectrum image shows the frequency content of an audio signal over time, with the low frequencies at the bottom and the high frequencies at the top. It is the visual style of audio editors and music visualizers, and FFmpeg can render it as a still image or a video.
Aug 28, 2026 -
Guide
Generate a waveform image from audio
A waveform image is a horizontal line graph showing the amplitude of an audio signal over time. Podcasts, DAWs, and audio editors all show one; you can generate one as a static image with FFmpeg, which is useful for embedding in a blog post or a report. The command ffmpeg
Aug 27, 2026 -
Guide
Apply a 3D LUT for color
A 3D LUT is a file that maps every RGB color to another RGB color via a three-dimensional lookup table. Colorists use them to apply a specific look (filmic, vintage, brand color) to a flat source. FFmpeg can apply a .cube file directly, so the same LUT used in
Aug 26, 2026 -
Guide
Replace green-screen background with chromakey
The chromakey filter makes a color in the source transparent, so you can overlay the foreground on a different background. The classic case is a green or blue screen studio shot; the practical case is anything where you want to replace a flat-colored region with another image or video.
Aug 25, 2026 -
Guide
Add a vignette
A vignette is a soft darkening around the edges of the frame, like an old lens or a portrait photo. It draws the eye to the center and adds a subtle cinematic look. The `vignette` filter in libavfilter is a one-line effect with parameters for angle, aspect, and softness.
Aug 24, 2026 -
Guide
Convert to grayscale
Stripping the color from a video is a stylistic choice for music videos, flashbacks, or text overlays, and a technical one for archival footage or color-blind accessibility. The `format=gray` filter does the work in one line, but you have to chain a second format filter to keep the
Aug 21, 2026 -
Guide
Adjust brightness, contrast, saturation with eq
The eq filter is the workhorse for a quick color correction: brightness, contrast, saturation, gamma, and a per-channel red/blue/green balance. It is less precise than curves but faster to type, and the parameters are linear so you can predict the result without rendering. The command ffmpeg -i
Aug 20, 2026 -
Guide
Color grade with the curves filter
The curves filter is the most precise color tool in libavfilter. It applies a piecewise-linear function to a channel (red, green, blue, luma, or all), letting you lift the shadows, roll off the highlights, or change the contrast at a specific luminance range. The command ffmpeg -i in.mp4
Aug 19, 2026 -
Guide
Stabilize shaky video with vidstab
Handheld phone footage, action-cam clips, and drone passes without a gimbal are rarely stable. The vidstab filter set detects the camera motion in a first pass, then applies a smoothing transform in the encode pass. The result looks like the camera was on a tripod, with a small zoom-
Aug 18, 2026 -
Guide
Add a vintage film-grain effect
The `grain` filter adds film-like noise to a video so a clean digital source can read as analog, archival, or hand-processed. It is a stylistic effect — you would not use it for documentary footage you want to look neutral, but it is a one-line effect for moody
Aug 17, 2026 -
Guide
Blur video with boxblur
Boxblur is the fastest blur in libavfilter and is the right tool when you need to anonymize a face, hide a license plate, or soften a background. It is also the building block of many other effects — a soft vignette, a focus-pull, or a face-blur before a privacy
Aug 14, 2026 -
Guide
Sharpen video with unsharp
If a video looks soft after encoding, scaling, or denoising, a one-pass unsharp sharpen restores perceived detail. The filter builds a blurred copy of the frame and subtracts it, leaving the high-frequency edges that read as 'sharp' to the eye. The command ffmpeg -i in.mp4
Aug 13, 2026 -
Guide
Denoise video with hqdn3d
Old home-video cameras, low-light phone footage, and high-ISO stills converted to video all carry temporal noise — random pixel changes between adjacent frames. hqdn3d is a high-quality 3D denoiser that averages each pixel against its neighbors in space and time, smoothing the noise while preserving real motion.
Aug 12, 2026 -
Guide
Deinterlace an interlaced video
Interlaced video splits each frame into two fields captured 16ms apart. Modern displays are progressive, so interlaced content shows combing artifacts on motion. The yadif filter deinterlaces by interpolating one field from the other, removing the artifact without re-encoding the static parts of the image. The command ffmpeg -i
Aug 11, 2026 -
Guide
Extract a subtitle track to SRT
Many video files carry subtitle streams inside the container, often as a `mov_text` track in MP4 or a PGS bitmap track in MKV. If you want to edit them in a text editor, generate transcripts, or burn them back in with custom styling, the first step is to extract
Aug 10, 2026 -
Guide
Embed custom metadata tags
FFmpeg can attach arbitrary key/value metadata to the container and to individual streams. The most common use is to set the title, artist, year, or comment on a finished audio or video file so media players show it in the info panel. The command ffmpeg -i in.m4a -metadata
Aug 7, 2026 -
Guide
Strip all metadata from a file
Many cameras and editing tools embed a long list of metadata fields: author, location, device serial, encoder settings, edit timestamps. If you are about to publish a file and want to remove that surface, the `map_metadata -1` flag drops every container-level tag in one pass. The command ffmpeg
Aug 6, 2026 -
Guide
Generate a media file checksum
If you need a stable identifier for a media file that survives renames and metadata edits, do not hash the file bytes. The header and tags can change without the perceptual content changing. Hash the decoded stream instead, so two encodes of the same source give the same value. The
Aug 5, 2026 -
Guide
Test decode integrity with the null muxer
The fastest way to know whether a file decodes without errors from start to end is to run it through the null muxer. FFmpeg decodes every frame, throws the output away, and reports any decode error in real time. It produces no output file, so it costs no disk space.
Aug 4, 2026 -
Guide
Use ffprobe for JSON metadata
The human-readable output of `ffmpeg -i` is great for eyes and bad for scripts. ffprobe has a JSON output mode that exposes the same data as a structured document, so a Python, Node, or shell script can read stream count, codec names, duration, and bitrates without parsing free-form
Aug 3, 2026