A Beginner's Guide to Using ffmpeg

Introduction

I did not start with ffmpeg. I started with Audacity for audio, then iOS Clips for quick video, then paid tools like InVideo and HippoVideo when I needed polish. At some point, batch-processing WAV files to 192 kbps MP3 for podcast episodes led me down StackExchange and Reddit threads. Almost every "batch audio" tutorial pointed back to one binary: ffmpeg.

So I installed it on my Debian laptop. I tried commands from YouTube, broke a few files, fixed others, and eventually started asking LLMs (Inkling, Thinking Machines Lab) for options. The problem with that phase? It became too easy to copy, paste, and hope. Learning stalled. I decided I needed my own structured cheat sheet — not to replace understanding, but to stop re-typing the same flags every time.

This post is that sheet. The final structure, formatting, and edits are mine; the brainstorming and syntax checks came from LLM conversations. If you are also moving away from GUI subscriptions toward a terminal-first workflow, this is my current working set.


Summary — English

This is my working set of ffmpeg commands for podcast and content production: merging clips, making image slideshows, mixing voiceover with music, burning subtitles, adding watermarks, trimming, upscaling to 1080p/4K, remuxing MKV/MOV to MP4, converting images (HEIC/WebP/AVIF/PNG to JPG), and audio transcoding (WAV to MP3 192k, or OGG). Most codecs (libx264, libmp3lame, libvorbis, libass, drawtext) ship with Debian's ffmpeg package. Only HEIC (libheif), NVIDIA encoding (NVENC), and VAAPI drivers need extra installation. I have listed exactly what I installed at the end.

सारांश — हिंदी (Hindi)

यह मेरी व्यक्तिगत ffmpeg चीट शीट है — पॉडकास्ट और वीडियो प्रोडक्शन के लिए। ऑडेसिटी से MP3, iOS क्लिप्स से शुरुआत, फिर डेबियन पर ffmpeg। ज़्यादातर कोडेक्स (libx264, libmp3lame, subtitles) पहले से शामिल हैं। HEIC, NVIDIA (NVENC), और VAAPI के लिए अलग इंस्टॉलेशन चाहिए। अंत में मेरी इंस्टॉलेशन लिस्ट है।

Advantages of using ffmpeg

  • Speed / Batch — Once you know the flag, ffmpeg -i *.wav ... runs circles around opening Audacity or InVideo for every file.
  • Cross-platform — Same command on my Debian laptop, a server, or a macOS box. No license keys.
  • Open source / Free — No subscription like HippoVideo or InVideo. Updates come via apt.
  • One binary, many jobs — Merge, trim, subtitle burn, audio normalize, 4K upscale, remux. I do not switch apps.
  • Precise, repeatable — -crf 23 -preset medium -movflags +faststart is the exact same file quality every episode. No GUI drift.
  • Lightweight — Runs headless. I can process files over SSH without a desktop environment.

Limitations of using ffmpeg

  • Learning curve is real — -filter_complex "[2:a]volume=0.2[m];[1:a][m]amix..." does not explain itself. StackExchange and LLMs help, but you still need to read flags.
  • Copy-paste temptation — Without a personal cheat sheet (like this doc), it is easy to run commands without knowing why -c:v copy versus libx264 matters. Learning stalls.
  • Complex multi-function pipelines — Mixing audio, burning subtitles, applying transitions, and scaling in one line gets long and hard to debug when one bracket is wrong.
  • No visual preview — You do not see the crop, overlay position, or subtitle timing until you render and open the output.
  • Plugin gaps on Debian — HEIC (libheif), NVIDIA (NVENC), and some hardware drivers are not in the default package. You have to hunt packages or use heif-convert.
  • Error messages are terse — Invalid argument or Output file #0 does not contain any stream tells you something failed, not always which -map or filter broke.

How to Install ffmpeg on Debian

sudo apt update
sudo apt install ffmpeg fonts-dejavu-core mesa-va-drivers
ffmpeg -version

That is it for 90% of my work. The rest is in the plugin section at the end.


Audio Work

Where Audacity used to be my main workhorse — batching WAV to MP3 192k, mixing voice and music, normalizing levels.

  1. Add Audio (Voiceover Replacement) When I re-record a voice track, I map it over the video and trim to the video length.
ffmpeg -i video.mp4 -i voiceover.mp3 -c:v copy -c:a aac -shortest output.mp4
  1. Add Music + Voiceover For intro music under my voice, I lower the music to 20% and mix.

    ffmpeg -i video.mp4 -i voiceover.wav -i music.mp3 -filter_complex "[2:a]volume=0.2[m];[1:a][m]amix=inputs=2:duration=first[a]" -map 0:v -map "[a]" -c:v copy -shortest output.mp4
  2. Extract Audio When I only need the audio track from a video recording.

ffmpeg -i video.mp4 -vn -acodec copy audio.m4a
ffmpeg -i video.mp4 -vn -ar 44100 -ac 2 -b:a 192k audio.mp3
  1. Normalize Loudness (EBU R128) Before uploading, I normalize voice levels so episodes sound consistent.
ffmpeg -i input.mp4 -af "loudnorm=I=-16:TP=-1.5:LRA=11" -c:v copy -c:a aac -b:a 192k normalized.mp4
  1. Convert Audio Formats

This replaced my Audacity batch-export routine for podcast audio.

# WAV → MP3 192 kbps (CBR)
ffmpeg -i input.wav -c:a libmp3lame -b:a 192k output.mp3

# WAV → high-quality OGG Vorbis
ffmpeg -i input.wav -c:a libvorbis -q:a 8 output.ogg

# MP3 / OGG → WAV (lossless PCM)
ffmpeg -i input.mp3 -c:a pcm_s16le -ar 44100 -ac 2 output.wav
ffmpeg -i input.ogg -c:a pcm_s16le -ar 44100 -ac 2 output.wav

Merge Images and Videos

  1. Merge Videos

I use this when I record segments separately and want them stitched without re-encoding.

# inputs.txt:
# file 'video1.mp4'
# file 'video2.mp4'
ffmpeg -f concat -safe 0 -i inputs.txt -c copy output.mp4
  1. Merge Image and Video (Cover/Intro)

Before I upload, I often prepend a static cover image for 3 seconds.

# Make cover clip
ffmpeg -loop 1 -t 3 -i image.jpg -i video.mp4 -filter_complex "[0:v]scale=720:1280:force_original_aspect_ratio=increase,crop=720:1280,format=yuv420p[v]" -map "[v]" -map 1:a? -c:v libx264 -shortest cover.mp4

# Then concat cover + video via inputs.txt with -c copy
  1. Convert Multiple Images to Video

I turned a set of episode artwork images into a slideshow for social clips.

ffmpeg -framerate 1/2 -i img%03d.jpg -c:v libx264 -pix_fmt yuv420p output.mp4
  1. Add Screenshot / Thumbnail

Single frame for episode art or social previews.

ffmpeg -ss 00:00:05 -i video.mp4 -vframes 1 -q:v 2 thumb.jpg
ffmpeg -i video.mp4 -vf "fps=1/10,scale=320:-1" thumb_%03d.jpg

Advanced Video Commands

### Video Assembly *Stitching takes, cutting dead air, fixing broken files, and scaling for delivery.*
  1. Merge Videos

    ffmpeg -f concat -safe 0 -i inputs.txt -c copy output.mp4
  2. Add Transition (Crossfade)

I use this when joining two takes of the same intro.

ffmpeg -i video1.mp4 -i video2.mp4 -filter_complex "[0:v][1:v]xfade=transition=fade:duration=1:offset=8[v];[0:a][1:a]acrossfade=d=1[a]" -map "[v]" -map "[a]" output.mp4
  1. Trim / Cut

Quick cuts without re-encoding (keyframe-bound) or precise cuts (re-encode).

# Fast keyframe cut
ffmpeg -ss 00:02:30 -t 45 -i input.mp4 -c copy trimmed.mp4

# Frame-accurate
ffmpeg -ss 00:02:30 -t 45 -i input.mp4 -c:v libx264 -crf 18 -preset fast -c:a copy trimmed_precise.mp4
  1. Picture-in-Picture

When I overlay a reaction clip or B-roll over main footage.

ffmpeg -i main.mp4 -i pip.mp4 -filter_complex "[1:v]scale=320:-1[pip];[0:v][pip]overlay=W-w-20:H-h-20:enable='between(t,5,15)'" -c:v libx264 -crf 20 -c:a copy pip_output.mp4
  1. Repair Corrupt MP4 + Strip Metadata

Fixes broken recordings and removes metadata before sharing.

ffmpeg -err_detect ignore_err -i corrupt.mp4 -c copy -movflags +faststart fixed.mp4
ffmpeg -i input.mp4 -map_metadata -1 -c:v libx264 -crf 20 -c:a copy clean.mp4
  1. Convert to Full HD or 4K

Upscaling for archive or high-res delivery.

# 1080p with letterbox/pad
ffmpeg -i input.mp4 -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(1920-iw)/2:(1080-ih)/2,format=yuv420p" -c:v libx264 -crf 17 -preset slow -c:a copy 1080p.mp4

# 4K H.264
ffmpeg -i input.mp4 -vf "scale=3840:2160" -c:v libx264 -crf 17 -preset medium -pix_fmt yuv420p -c:a aac -b:a 192k 4k_h264.mp4

# 4K HEVC (smaller file)
ffmpeg -i input.mp4 -vf "scale=3840:2160" -c:v libx265 -crf 23 -preset medium -tag:v hvc1 -c:a aac -b:a 192k 4k_hevc.mp4

Screenshot of ffmpeg in linux debian terminal

Overlays & Graphics

*Text titles, watermarks, portrait padding, and resizing without distortion.*
  1. Add Text (Title with Time Window)

For episode titles that appear between seconds 2 and 7.

ffmpeg -i input.mp4 -vf "drawtext=text='Title Here':fontcolor=white:fontsize=24:x=(w-text_w)/2:y=(h-text_h)/2:enable='between(t,2,7)'" -c:a copy output.mp4

17. Add Watermark

My podcast logo in the bottom-right, semi-transparent via PNG alpha.

```bash
ffmpeg -i input.mp4 -i watermark.png -filter_complex "[1:v]scale=100:-1[wm];[0:v][wm]overlay=W-w-10:H-h-10" -c:a copy output.mp4
  1. Resize / Scale / Pad

I use this for portrait videos (720x1280) with black bars preserved.

ffmpeg -i input.mp4 -vf "scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(720-iw)/2:(1280-ih)/2:color=black" -c:v libx264 -crf 22 -pix_fmt yuv420p output.mp4

Technical Housekeeping

*Subtitles, compression presets, hardware acceleration checks, and image format conversions.*
  1. Speed Up / Slow Down + Reverse

For teaser clips — 2x speed or reversed for effect.

ffmpeg -i input.mp4 -vf "setpts=0.5*PTS" -af "atempo=2.0" fast.mp4
ffmpeg -i input.mp4 -vf "reverse" -af "areverse" reversed.mp4
  1. Burn Subtitles

Hardcoding SRT files for platforms that do not read sidecar subtitles.

ffmpeg -i video.mp4 -vf "subtitles=subtitle.srt:fontsdir=/usr/share/fonts:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf" -c:v libx264 -crf 20 -c:a copy burned.mp4
  1. Compress / Shrink for Web

My default export preset for web upload.

ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -profile:v high -level 4.2 -c:a aac -b:a 128k -movflags +faststart -pix_fmt yuv420p web.mp4
  1. Hardware Acceleration

When I render long files, VAAPI saves time on my laptop's Intel iGPU.

ffmpeg -hwaccels

# VAAPI example
ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i input.mp4 -vf 'format=nv12,hwupload' -c:v h264_vaapi -qp 23 -c:a copy hw.mp4
  1. Convert Image Formats

I moved from native iOS exports and InVideo to batch image conversion in terminal.

# PNG / WebP / AVIF / JPEG → JPG
ffmpeg -i input.png -q:v 2 output.jpg
ffmpeg -i input.webp -q:v 2 output.jpg
ffmpeg -i input.avif -q:v 2 output.jpg

# Reverse: JPG → PNG / WebP / AVIF
ffmpeg -i input.jpg output.png
ffmpeg -i input.jpg -c:v libwebp -quality 85 output.webp
ffmpeg -i input.jpg -c:v libaom-av1 -crf 30 -b:v 0 output.avif

Note: HEIC/HEIF is handled separately (see plugin section) because standard Debian ffmpeg does not include libheif.


Native Features in ffmpeg vs Add-ons / Plugins

What I Use Built-in? Extra Needed on Debian
libx264, libx265, libmp3lame, libvorbis Yes --
drawtext, subtitles (libass) Yes Font files (fonts-dejavu-core)
loudnorm, amix, volume, scale, overlay Native filters --
libwebp, libpng, libjpeg, libaom-av1 (AVIF) Yes --
HEIC / HEIF decode or encode Not in default build libheif-examples + libheif-plugin-libde265 (use heif-convert)
VAAPI (h264_vaapi) Compiled in mesa-va-drivers or i965-va-driver
NVENC (h264_nvenc) Not in default binary nvidia-driver + libffmpeg-nvenc-dev

Takeaways / Conclusion

This sheet exists because I got tired of searching StackExchange for the same -c:v libx264 -crf 23 line. I still use InVideo or HippoVideo for quick social graphics, but when I need batch consistency, precise trimming, or custom audio normalization, ffmpeg is faster and repeatable.

The biggest lesson from my LLM trial-and-error phase: copy-paste works once, but writing down why a flag is there (-shortest, -map_metadata -1, force_original_aspect_ratio) is what makes it a cheat sheet rather than a gamble. I edited the structure and wording here myself; the syntax verification came from Inkling and Thinking Machines Lab. If you are building your own reference, do the same — use LLMs for brainstorming, then format it so the commands make sense to your workflow six months later.


References / Notes

(References kept brief — links above cover syntax, codec support, and plugin details.)


Installation of Plugins / Add-ons (Optional)

Exactly what I installed on my Debian laptop for everything above.

# Core + fonts for drawtext/subtitles
sudo apt update
sudo apt install ffmpeg fonts-dejavu-core fonts-liberation

# VAAPI drivers (Intel/AMD iGPU)
sudo apt install mesa-va-drivers libva2

# Older Intel fallback
sudo apt install i965-va-driver

# NVIDIA NVENC (requires proprietary nvidia-driver first)
# After nvidia-driver is installed:
sudo apt install libffmpeg-nvenc-dev
# Verify:
ffmpeg -encoders | grep nvenc

# HEIC / HEIF (standard ffmpeg lacks libheif)
sudo apt install libheif-examples libheif-plugin-libde265
# If plugin is in backports:
# sudo apt -t bookworm-backports install libheif-plugin-libde265

# Convert HEIC without ffmpeg
heif-convert input.heic output.jpg

# Verify your build
ffmpeg -codecs | grep -E "heif|aom|webp|mp3|vorbis|x264|x265"
ffmpeg -filters | grep -E "drawtext|subtitles|loudnorm"
ffmpeg -hwaccels

That is my current setup. It covers podcast audio batch work, video stitching, image slideshows, and the occasional 4K upscale — without opening Audacity, iOS Clips, or a paid editor unless I actually want to.


feature image: https://trac.ffmpeg.org/

This post was published under Commandline and last updated on 2026-07-21 .