Get Information of Media File using FFmpeg

Get Information of Media File using FFmpeg

FFmpeg includes several command-line utilities for examining multimedia files and displaying details about their contents. File information such as duration, bitrate, resolution, codecs, frame rate, audio format, and subtitles can be useful when troubleshooting media files or verifying their properties. This tutorial explains how to get information of media file using FFmpeg.

The ffprobe utility is designed to inspect media files and display information about their containers and individual streams. It can show general file metadata as well as details about video, audio, and subtitle streams.

Download a sample video file for testing:

curl -sSo test.mp4 https://raw.githubusercontent.com/chromium/chromium/main/media/test/data/bear-1280x720-avt_subt_frag.mp4

The following command displays information about the video file:

ffprobe -hide_banner test.mp4

The command provides output similar to:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1iso6mp41
    encoder         : Lavf56.15.102
  Duration: 00:00:02.77, start: 0.000000, bitrate: 2070 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 2010 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, start 0.033367 (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 72 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default)
    Metadata:
      handler_name    : SubtitleHandler

The output contains information about the container and each stream detected in the file.

Leave a Comment

Cancel reply

Your email address will not be published.