Inspect & Troubleshoot Media with FFprobe and FFmpeg

Fri Aug 16 2024

Use ffprobe for deep inspection and FFmpeg logs to diagnose container, stream, and sync issues.

When a file won’t play or encodes poorly, start with ffprobe. It exposes stream properties and container metadata you can use to fix issues.

ffprobe Basics

# Quick summary (streams + format) ffprobe -hide_banner -show_streams -show_format input.mp4 # JSON for key fields on v:0 ffprobe -v error -select_streams v:0 \ -show_entries stream=codec_name,profile,width,height,avg_frame_rate,pix_fmt,color_space,color_transfer,color_primaries \ -of json input.mp4

Check profile/level, pixel format, frame rate, and color information.

Debugging Encodes

# Verbose transcode logs for debugging ffmpeg -v verbose -i in.mp4 -c:v libx264 -crf 22 -c:a aac -b:a 128k out.mp4 # Strict error mode ffmpeg -v error -xerror -i in.mp4 -c copy out.mkv

Pitfalls

  • Don’t confuse container fields with stream fields.
  • Variable frame rate (VFR) vs constant (CFR) can affect sync and seeking.

Armed with ffprobe and logs, you can quickly pinpoint format, codec, or muxing problems and choose the right fix.