▶ Video & streaming

Inspecting a video file with MediaInfo and ffprobe

How to read codec, profile, level, bitrate, frame rate, colour and tracks of a video file with MediaInfo and ffprobe to diagnose playback problems quickly.

When a video will not open, looks wrong, loses sync or is rejected by a platform, the first thing to do is not to reconvert it at random but to look inside it. Two free tools let you do this in seconds: MediaInfo, with a graphical interface and a command-line version, and ffprobe, which is part of FFmpeg and also designed for use in scripts. Knowing how to read what they show turns trial-and-error diagnosis into a targeted check.

MediaInfo: the overview

MediaInfo presents information in sections: General, Video, Audio, Text (subtitles) and sometimes Menu (chapters). The text view, more complete than the default one, is enabled from the view menu. From the command line:

mediainfo video.mp4

The General section

  • Format: the container, for example MPEG-4 or Matroska;
  • Duration and overall bitrate;
  • File size;
  • Writing application: which program created the file, useful for working out where a defect comes from.

The Video section

This is the one to read most carefully:

  • Format and profile, for example AVC High@L4.1 or HEVC Main 10@L5.1;
  • Width, height and display aspect ratio;
  • Frame rate mode: constant or variable;
  • Frame rate, for example 25.000 or 29.970;
  • Colour space, chroma subsampling and bit depth;
  • Scan type: progressive or interlaced, with the field order;
  • colour primaries, transfer characteristics and range, if declared;
  • Encoder settings: for x264 and x265 the full string of options used is often stored.

The Audio section

Codec, number of channels, sample rate, bitrate, language and, if present, the delay relative to video, a valuable figure when audio is out of sync.

ffprobe: data for scripts

ffprobe shows similar information but is better suited to automation because it produces structured output:

ffprobe -v error -show_format -show_streams -of json video.mp4

With -of json the result is in JSON, easy to process with a programming language. To extract only the fields you need, use -show_entries:

ffprobe -v error -select_streams v:0 -show_entries stream=codec_name,profile,width,height,r_frame_rate,pix_fmt -of csv=p=0 video.mp4

Frame rate is shown as a fraction, for example 30000/1001, that is 29.97 fps.

Analysing individual frames

ffprobe can also list frames one by one, showing type (I, P or B), size and timestamp:

ffprobe -v error -select_streams v:0 -show_entries frame=pict_type,pkt_size,best_effort_timestamp_time -of csv video.mp4

This is useful for checking the keyframe interval, confirming keyframes are aligned for streaming or spotting size peaks.

From symptoms to fields to check

Symptom Field to check
the TV will not open the file video codec format, profile and level, container
picture but no sound audio codec
washed-out or over-contrasty colours range, primaries, transfer curve
comb lines on motion scan type
audio drifting away from video frame rate mode (variable)
distorted picture pixel and display aspect ratio
file much heavier than expected bitrate, encoder settings
video starts only after the full download position of the index in the file

The last point deserves a note: in an MP4 the index (the moov atom) can sit at the end of the file. MediaInfo reports this in the General section; if it is at the end, a conversion with the -movflags +faststart option moves it to the start without re-encoding.

Profile and level: why they matter

The profile indicates which compression tools were used, the level sets limits on resolution, frame rate and bitrate. A hardware decoder declares which profiles and levels it supports: an H.264 High@L5.1 file may be rejected by a device that goes up to L4.1, even though the codec is the same. Reading these two values explains many seemingly inexplicable «unsupported format» cases.

A word of caution on metadata

Some of the information shown is declared in the file and does not always match reality. A video may declare a constant frame rate yet have irregular timestamps, or declare limited range with full-range pixels. When the symptoms do not fit the metadata, check the real data, for example by analysing frames with ffprobe or measuring pixel values with an FFmpeg filter.

A useful habit

In my work, before and after every important conversion I save the MediaInfo report to a text file next to the video. It takes a few seconds and, if something goes wrong, lets you compare exactly what changed between the original and the result.

In short

  • MediaInfo offers a clear view by section; ffprobe produces structured data for scripts.
  • Codec, profile and level explain most compatibility problems.
  • Range, primaries and transfer curve explain colour problems.
  • Variable frame rate and audio delay explain many sync problems.
  • Metadata are declarations: when in doubt, check the real data.
MM
Marco Marzaduri

Marco Marzaduri works in cybersecurity, digital forensics and web development. A computer science graduate, he combines rigorous technical analysis with attention to the people who use technology.

Read also