FreeEd4Med Logo
FFmpeg Cheat Sheet
FreeEd4Med Media SuperTool v10.19

FFmpeg Cheat Sheet

Structured reference guide covering the most important FFmpeg commands used throughout the FreeEd4Med Media SuperTool workflow. Commands are grouped by workflow categories with practical examples, tips, and variations. Use this cheat sheet when scripting repetitive tasks, validating files, or troubleshooting formats.

1. Basics & Diagnostics

1.1 Inspect File Information

# Summarized format info
ffprobe -hide_banner -i input.mp4

# JSON output with all streams
ffprobe -loglevel quiet -show_format -show_streams \
        -of json -i input.mp4

# Audio-only diagnostic (no video)
ffprobe -select_streams a:0 -show_entries stream=codec_name,channels,sample_rate \
        -of default=noprint_wrappers=1 input.wav

1.2 Silence Detection (Quality Control)

# Detect silences longer than 2 seconds below -50 dBFS
ffmpeg -i input.wav -af "silencedetect=noise=-50dB:d=2" -f null -

1.3 File Duration

ffprobe -i input.mp3 -show_entries format=duration -v quiet -of csv="p=0"
For scripting, wrap these commands in bash functions called by the Media SuperTool. Example: get_media_duration() { ffprobe ...; }

2. Audio Conversion & Processing

2.1 Format Conversion

# MP3 → WAV (16-bit)
ffmpeg -i song.mp3 -ar 44100 -ac 2 -sample_fmt s16 output.wav

# WAV → FLAC (lossless)
ffmpeg -i master.wav -compression_level 8 master.flac

# WAV → AAC (M4A)
ffmpeg -i master.wav -c:a aac -b:a 256k track.m4a

2.2 Resampling & Bit Depth

# Convert 48 kHz 32-bit float → 44.1 kHz 24-bit integer
ffmpeg -i input.wav -ar 44100 -sample_fmt s32 -c:a pcm_s24le output.wav

2.3 Loudness Normalization

# Integrated loudness to -14 LUFS (streaming standard)
ffmpeg -i input.wav -af "loudnorm=I=-14:TP=-1.0:LRA=11" normalized.wav

2.4 Extract Audio from Video

# Preserve original codec (copy)
ffmpeg -i video.mp4 -vn -acodec copy audio.aac

# Extract as PCM WAV
ffmpeg -i video.mp4 -vn -acodec pcm_s16le audio.wav

3. Video Conversion & Encoding

3.1 Static Image + Audio → Video

ffmpeg -loop 1 -i artwork.jpg -i track.wav \
  -c:v libx264 -tune stillimage \
  -c:a aac -b:a 320k -shortest -pix_fmt yuv420p video.mp4

3.2 Looping Video Clip

ffmpeg -stream_loop 3 -i loop.mp4 -i audio.wav \
  -map 0:v -map 1:a -c:v libx264 -shortest export.mp4

3.3 Re-encode with Specific Quality

# CRF 18 for visually lossless quality (x264)
ffmpeg -i input.mov -c:v libx264 -crf 18 -preset slow -c:a aac -b:a 192k output.mp4
CRF (Constant Rate Factor) scale: 17-20 = High quality, 21-24 = Balanced, 25+ = Low quality. Lower CRF = higher quality/larger file.

3.4 Resize Video

ffmpeg -i input.mp4 -vf "scale=1280:720:force_original_aspect_ratio=decrease,
                       pad=1280:720:(ow-iw)/2:(oh-ih)/2" output_720p.mp4

4. Subtitles & Typography

4.1 Burn Subtitles (ASS styling)

# Force specific styling when burning subtitles
ffmpeg -i video.mp4 -vf "subtitles=lyrics.ass:force_style='FontName=Arial,FontSize=32,
                PrimaryColour=&H00FFFFFF,OutlineColour=&H00000000,MarginV=40'" \
                -c:a copy final.mp4

4.2 Convert SRT → ASS with Aegisub

Use Aegisub for full styling control. Save as .ASS. The Media SuperTool's typography engine automatically writes ASS force_style parameters.

4.3 Subtitle Delay Compensation

# Shift subtitles by +500ms and burn into video
ffmpeg -i video.mp4 -vf "subtitles=lyrics.srt:si=0:original_size=1920x1080:force_style='MarginV=50':
      fontsdir=/path/to/fonts,subdelay=500" -c:a copy output.mp4

5. Visualizers & Waveforms

5.1 Circular Waveform ("Portal")

ffmpeg -i audio.wav -loop 1 -i background.jpg \
  -filter_complex "[0:a]aformat=channel_layouts=mono,showwaves=s=1280x720:mode=cline:colors=violet,
  geq='p(mod(W/PI*(PI+atan2(H/2-Y,X-W/2)),W),H-2*hypot(H/2-Y,X-W/2))':
  a='alpha(mod(W/PI*(PI+atan2(H/2-Y,X-W/2)),W),H-2*hypot(H/2-Y,X-W/2))'[w];
  [1:v][w]overlay=(W-w)/2:(H-h)/2:shortest=1" \
  -c:v libx264 -c:a copy portal.mp4

5.2 Spectrum Analyzer (Scrolling)

ffmpeg -i audio.wav -filter_complex "showspectrum=slide=scroll:mode=combined:color=magma:
          scale=log:fscale=log:s=1920x1080" -c:v libx264 -c:a copy spectrum.mp4

5.3 Waveform Thumbnails

# Transparent background waveform
ffmpeg -i audio.wav -filter_complex "aformat=channel_layouts=mono,
            showwavespic=s=1280x720:colors=white" -frames:v 1 waveform.png

6. Social Media Output

6.1 TikTok Vertical Video

ffmpeg -i horizontal.mp4 -vf "split[main][copy];
  [copy]scale=-1:1920,boxblur=20:20[bg];
  [bg]crop=1080:1920[blur];
  [blur][main]overlay=(W-w)/2:(H-h)/2" \
  -c:v libx264 -c:a aac tiktok.mp4

6.2 YouTube Master

ffmpeg -i master.mov -c:v libx264 -preset slow -crf 18 \
  -pix_fmt yuv420p -c:a aac -b:a 320k youtube.mp4

6.3 X (Twitter) Optimized

ffmpeg -i input.mp4 -c:v libx264 -pix_fmt yuv420p \
  -preset medium -b:v 3500k -maxrate 3500k -bufsize 7000k -c:a aac -b:a 160k twitter.mp4

7. Filters, Metadata, and Utilities

7.1 Color Channel Mixer (Watermark transparency)

ffmpeg -i video.mp4 -i logo.png -filter_complex "[1]format=rgba,
  colorchannelmixer=aa=0.5[logo]; [0][logo]overlay=10:10" -c:a copy output.mp4

7.2 Metadata Editing

ffmpeg -i input.flac -map_metadata 0 \
  -metadata title="Song Title" \
  -metadata artist="Artist Name" \
  -metadata album="Album Name" \
  -metadata date="2025" \
  -c copy output.flac

7.3 Thumbnail Extraction

# Capture frame at 15 seconds
ffmpeg -ss 00:00:15 -i video.mp4 -frames:v 1 thumbnail.png

8. Advanced Tips & Optimization

8.1 FFmpeg Preset Reference (x264)

PresetSpeedQuality/File Size
ultrafastFastestLowest quality (large files)
superfastVery fastLow quality
fasterFastModerate quality
mediumDefaultBalanced
slowSlowHigh quality (smaller files)
veryslowSlowestBest quality (smallest files)
Use -preset slow for final masters (YouTube, archival). Use -preset faster for previews or quick iterations.

8.2 Two-Pass Encoding (Bitrate Control)

# Pass 1
ffmpeg -y -i input.mp4 -c:v libx264 -b:v 4000k -pass 1 -an -f mp4 /dev/null

# Pass 2
ffmpeg -i input.mp4 -c:v libx264 -b:v 4000k -pass 2 -c:a aac -b:a 192k output.mp4

8.3 Hardware Acceleration (NVENC Example)

ffmpeg -i input.mp4 -c:v h264_nvenc -preset slow -rc vbr -cq 19 -b:v 5M -maxrate 7M \
  -c:a aac -b:a 192k output_nvenc.mp4

8.4 Batch Conversion Script (Audio)

#!/bin/bash
for file in *.wav; do
  base=${file%.*}
  ffmpeg -i "$file" -ar 44100 -ac 2 -c:a libmp3lame -b:a 256k "$base.mp3"
done
When batch-processing, always test with a single file first. FFmpeg will overwrite existing files without prompting unless you add -n (fail if exists) or -y (overwrite) flags explicitly.