If you work with video or audio files—whether for content creation, media archiving, IT support, or quality control—understanding file metadata is essential. That’s where mediainfo comes in.

The mediainfo command-line tool allows you to quickly extract detailed technical information from multimedia files directly in your terminal. From file format and codec details to bitrate, resolution, duration, and audio properties, it delivers everything you need in seconds.

In this complete guide, you’ll learn how to use the mediainfo command effectively, including real-world use cases, practical examples, and workflow tips.

What Is MediaInfo?

MediaInfo is a lightweight yet powerful utility designed to analyze and display metadata from audio and video files. It works on Linux, macOS, and Windows, and supports a wide range of formats including MP4, MKV, AVI, MOV, MP3, FLAC, and more.

Unlike graphical media tools, mediainfo operates in the command line, making it ideal for:

  • System administrators
  • Video editors
  • Media archivists
  • Developers
  • Automation workflows

It is fast, reliable, and easy to integrate into scripts.

READ 👉  14 Best Places to Buy Linux Laptops in 2026

Use Case 1: Display Metadata for a Media File in the Console

Command

mediainfo file

Why This Is Useful

When managing multimedia content, you often need to verify:

  • Video resolution
  • Codec compatibility
  • Bitrate quality
  • File duration
  • Audio format

Instead of opening a heavy media editor, you can instantly inspect the file directly from your terminal.

This is especially useful when:

  • Troubleshooting playback issues
  • Checking encoding settings
  • Auditing media libraries
  • Validating uploads before publishing

How It Works

  • mediainfo → launches the MediaInfo tool
  • file → replace with the path to your audio or video file

Example:

mediainfo ExampleFile.mp4

Sample Output

General
Complete name                            : ExampleFile.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42
File size                                : 600 KiB
Duration                                 : 30 s
Overall bit rate                         : 167 kb/s

Video
ID                                       : 1
Format                                   : AVC
Codec ID                                 : avc1
Bit rate                                 : 150 kb/s
Width                                    : 720 pixels
Height                                   : 480 pixels

Audio
ID                                       : 2
Format                                   : AAC LC
Bit rate                                 : 16.1 kb/s

This structured output makes it easy to quickly assess a file’s technical properties.

Use Case 2: Save Metadata Output to a File While Displaying It

Command

mediainfo --Logfile=out.txt file

Why This Is Useful

In professional environments, you may need to:

  • Archive media specifications
  • Send technical details to a client
  • Document file properties for compliance
  • Maintain logs for quality assurance

Using the --Logfile option allows you to:

✔ View metadata in the console
✔ Save it simultaneously to a file

This is particularly helpful in production pipelines or support documentation workflows.

How It Works

  • --Logfile=out.txt → saves output to a file named out.txt
  • You can specify any path, such as:
mediainfo --Logfile=/home/user/reports/video_report.txt file

Console Output Example

General
Complete name                            : ExampleFile.mp4
Format                                   : MPEG-4
File size                                : 600 KiB

Saved File Content (out.txt)

General
Complete name                            : ExampleFile.mp4
Format                                   : MPEG-4
File size                                : 600 KiB

This makes metadata sharing and long-term documentation effortless.

READ 👉  BleachBit 5.0 – Clean Up Junk Files and Speed Up Your PC

Use Case 3: List All Available Metadata Parameters

Command

mediainfo --Info-Parameters

Why This Matters

If you’re:

  • Developing scripts
  • Parsing output programmatically
  • Building automated media workflows
  • Extracting specific attributes only

You need to know exactly which metadata fields MediaInfo supports.

The --Info-Parameters option displays all extractable metadata attributes.

Example Output

Format
Format_Profile
Codec_ID
Bit_Rate
Width
Height
Duration
Audio_Format
Sample_Rate
Channels
Bit_Depth
...

This is especially valuable when building structured exports (JSON, CSV, XML) or filtering specific properties in scripts.

Why MediaInfo Is Essential for Media Professionals

The mediainfo command is more than just a metadata viewer. It plays a critical role in:

Video Production

  • Confirm encoding settings before publishing
  • Validate resolution and bitrate standards

Media Archiving

  • Audit file properties at scale
  • Maintain accurate media catalogs

IT and Support

  • Diagnose compatibility issues
  • Identify codec mismatches

Automation & DevOps

  • Integrate metadata checks into pipelines
  • Validate uploaded content automatically

Because it works in the terminal, it integrates seamlessly into shell scripts and batch processing systems.

Pro Tip: Combine MediaInfo with Other CLI Tools

For advanced workflows, you can pipe output into tools like:

  • grep → filter specific metadata fields
  • awk → parse structured output
  • jq → process JSON-formatted metadata

Example:

mediainfo file | grep "Bit rate"

This allows for fast extraction of key properties in large-scale operations.

Final Thoughts

The mediainfo command is one of the most practical and efficient tools available for multimedia analysis. Whether you need a quick metadata check, automated file validation, or documented technical reports, MediaInfo delivers accurate insights with minimal overhead.

Its simplicity makes it accessible for beginners, while its depth and scripting compatibility make it invaluable for professionals.

READ 👉  Internxt: Secure, Decentralized Cloud Storage for the Web3 Era

If you regularly work with video or audio files, mediainfo deserves a permanent place in your toolkit.

Did you enjoy this article? Feel free to share it on social media and subscribe to our newsletter so you never miss a post!

And if you'd like to go a step further in supporting us, you can treat us to a virtual coffee ☕️. Thank you for your support ❤️!
Buy Me a Coffee

Categorized in: