Seperis (seperis) wrote,
Seperis
seperis

  • Mood:

mediainfo - all you need to know about your movie and video file

I completely forgot Monday is a holiday. This is what WFH does to you; you forget holidays.

MediaInfo - Everything You Didn't Know About Your Movies and Videos

So I think I mentioned it before, but anyone with a media collection they want to analyze or vidders who want an easy way to document all their source super thoroughly might like to try Mediainfo, which does a full analysis of your media to get literally all the information about it--audio streams, video streams, all the encoders, bitrate, a billion more things than that, etc. It works on any platform. If you have a large media collection, this is for you.

Here is a mediainfo file on The Martian. This doesn't show all the possible options, btw, just like a lot of them.

About Templates

However, that's pretty slow to do one movie/video at a time; instead, use command line to do in batches. Better, to get specific information you want instead of All Of It My God, you can create a template for mediainfo to read.

I have written several templates; my latest is one that will get everything in a movie that I want and place it in a csv file in a single line, so when it's done, I can see all my movies and info in a single spreadsheet. All you'd need is a script or program to loop through your movies to add them to the file if you use Windows; if you use Linux, I have a bash script you can use as a template or I can tell you how to adapt it to your file locations. The limitations are how wide you want your spreadsheet as each movie has about five billion or so characteristics and a lot lot lot of redundancy.

How The Template Works
If you look at the xml or text of a mediainfo file for a movie (see above), it's split into groups: General, Video, Audio, Text, and Menu. In the template, each group gets its own line; you cannot mix them up. You don't have to use all the groups, but no matter what order you have them in on the template, it will still write them into the file in the order above (General, Video, Audio, Text, Menu).

To Create a Template
Open notepad or something plain text.

You start with the group you want, semicolon, then a list of all the properties you want from that group, each one surrounded by '%'. You can use any delimiter.

This is the command:
mediainfo --Inform=$template $movie 1>>$file

Here's my template that is stored in a plain text file:
General;%FileName%,%FileSize%,%Duration%,%AudioCount%,%TextCount%,
Video;%Format%,%InternetMediaType%,%OriginalSourceMedium%,
Audio;%Format/String%,%Format_Commercial%,%Title%,

Note: I put a comma at the end of the line for the future csv file to import into a spreadsheet. If you plan to import into a spreadsheet, make sure you put your delimeter at the end of the line.

This give me:
General--> movie name, size, duration, how many audio streams, how many text streams (subtitles)
Video-->The format (HEVC, AVC, MPEG), internet media type (encoder sometimes) and the original source (bluray, DVD, or if blank, that means I did the encoding myself)
Audio--the string name (MLP FBA 16-ch, DTS, AC-3), the commercial name (Dolby TrueHD with Dolby Atmos, Dolby Digital, DTS), and title which is specific type (7.1 surround sound, 5.1, etc).

Here's what my spreadsheet looks like using this template: Media Spreadsheet

That Spreadsheet Is Kinda Big
Yeah, all this on one line--especially with nine to seventeen audio streams--gets big (see sheet above). You can also do multiple templates, one for general, one for video, one for audio, etc, and run them one after the other.

mediainfo --Inform=$genTemplate $movie 1>>$generalFile
mediainfo --Inform=$vidTemplate $movie 1>>$videoFile
mediainfo --Inform=$audTemplate $movie 1>>$audioFile

The only problem with that is with the video only and audio only template, you'll also need to have General as well so you can get the movie name, since General is the only place the name property appears. so for a Video only, you'd do something like this.

General;%FileName%,
Video;%Format%,%InternetMediaType%,%OriginalSourceMedium%,

Mediainfo - All Properties List

For reference, here is a complete list of all properties available, separated by group (General, Video, Audio, Text, Menu).

Generally, to work out what is what, run mediainfo on a few movies (a bluray rip, a DVD rip, one you encoded yourself, one with DTS and one with Dolby, a vid you downloaded, etc), get the XML document for each, and contrast/compare what information is given. It's not always clear what does what--or if it does anything--until you check it in multiple formats. Some properties are very specific to the video type, audio type, or subtitle type.

I highly recommend this program. I'm currently adapting a script and template to use on my vid collection to find old formats/bad formats/redundancy/etc.

If you have any problem accessing the linked files, tell me; I set it to everyone but well, google is gonna google. Posted at Dreamwidth: https://seperis.dreamwidth.org/1077918.html. | You can reply here or there. | comment count unavailable comments
Tags: coding, my relationship with electronics
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments