to display MediaInfo in Lister
© 2013 by KV5R. Rev. 4/13/2013
MediaInfo is a free program that displays, well, media info. It’s available for all the usual platforms — Windows, Mac, and Linux. It can display media metadata in a variety of formats such as text, HTML, XML, sheet, and even user-defined. It queries dozens of common media formats and provides detailed information about them.
TotalCommander is, quite simply, the best file manager ever made for a computer. It builds on the wonderful, efficient two-pane model, first made popular in the late ’80s by Norton Commander, by adding incredible functionality, configurability, and an extensive plug-in library.
MediaInfo (for Windows) can add a right-click context menu entry, so you can simply right-click a media file and open the file in MediaInfo. But what if you want to see, or even save to a file, MediaInfo output for hundreds, or even thousands, of media files? Right-clicking each one is just too slow! Hence, this article.
I will show you three very useful things:
- how to integrate MediaInfo with TotalCommander’s F3 View,
- how to customize MediaInfo’s output with a template, and
- how to make a batch file that will run MediaInfo on your whole media library and generate a text file thereof, which you can then format into a media catalog.
How to integrate MediaInfo with TotalCommander
First, you will need TotalCommander, shareware, currently (2013) ~$44—the best money you’ll ever spend.
Lastly, you need to get the TotalCommander Lister plug-in called AnyCmd. It allows you to define any command-line tool to output to the Lister window. Download it, click it, and install it in TotalCommander. Then go to
\totalcmd\Plugins\wlx\anycmd\ and read the
index.html file therein.
Following along with that, first open
wincmd.ini (in the totalcmd root folder) and search for
[ListerPlugins] and delete the
n_detect="whatever" right under the line that contains the path to the anycmd.wlx. Save, Exit.
Then open the
lsplugin.ini (also in the totalcmd root folder) file and copy/paste:
[AnyCmd] DetectString=MULTIMEDIA & (EXT="AVI" | EXT="MP3" | EXT="MP4" | EXT="FLV" | EXT="MPG" | EXT="MOV" | EXT="WMA" | EXT="WMV") Command=C:\Utils\MediaInfo.exe --Output=file://C:\Utils\MediaInfoTemplate.mit "%s" Stream=3
C:\Utils is where ever you placed
MediaInfo.exe (the command-line version; in a PATHed folder). You can add other extensions, if desired.
Then open a new file and copy/paste:
General;FileName : %CompleteName%\r\nFormat : %Format% at %OverallBitRate_String% %OverallBitRate_Mode%, FileSize: %FileSize/String%, TRT %Duration/String%\r\n Video;Video : %Format% (%Format_Profile%) at %BitRate/String% %BitRate_Mode%, %Width% x %Height% (%DisplayAspectRatio/String%) at %FrameRate% FPS %FrameRate_Mode%\r\n Audio;Audio : %Format% %Format_Version%%Format_Profile% at %SamplingRate_String%, %BitRate/String% %BitRate_Mode%, %Channel(s)/String% %ChannelPositions%.\r\n
…and save it as
MediaInfoTemplate.mit (or where ever/whatever you put in lsplugin.ini). Note: there are only three (3) lines above, each ending in
\r\n. Don’t let word-wrap break them. If you don’t have (or want) a system PATHed folder for utilities, you can just put all this in your totalcmd folder, which should already be PATHed.
The above template is one I made specifically to produce a very compact output (else MediaInfo is very verbose), because we will later use it to make a media catalog (thousands of files), and the template packs a lot of info into only four lines per file. The output will look like:
FileName : H:\Video\On-YouTube\Speaker-Amp-Review-KV5R-720p-6Mbps(yt).mp4 Format : MPEG-4 at 6 169 Kbps VBR, FileSize: 438 MiB, TRT 9mn 55s Video : AVC (High@L3.1) at 5 933 Kbps VBR, 1280 x 720 (16:9) at 30.000 FPS CFR Audio : AAC LC at 48.0 KHz, 231 Kbps CBR, 2 channels Front: L R.
…instead of MediaInfo’s default of about 60 lines!
Now, restart TotalCommander (always necessary when making changes to its plug-ins, because it compiles configs to memory on start-up). Then, select a media file, such as an mp4, and hit
F3. You should now see MediaInfo’s output, formatted according to your template, in the Lister window. If it’s blank, something’s wrong, so go back and carefully check everything. Note that MediaInfo CLI does not generate error — it just fails silently. Note also that it fails with the tiniest error in a template! You must format the template file exactly, including no line breaks in its three sections.
To make your own custom template, see this resource: in the MediaInfo-CLI package, \contrib\CLI_Help.doc. Also, open a cmd prompt and enter
MediaInfo --InfoParameters > MediaInfo-Parameters.txt to save a TON of, well, info on parameters, which you can keep open as a reference as you work on the template (dual-monitor display! Yeah!).
How To Make a Batch File to Make a MediaInfo Catalog of Your Whole Library
Now that we have the compact template working, it’s just too easy to make it loop through all your media files and generate a catalog. Do like:
Open a new text file and copy/paste:
@echo off :: Usage example: MediaCatalog mp4 :: It MUST have a valid extension as the first and only parameter. :: Run it in the root folder of your media library. echo ========================================================================== echo PROCESSING *.%1 IN THE CURRENT FOLDER AND ALL SUB-FOLDERS with MediaInfo echo to MediaInfo.txt in the Current (starting) Folder. Wait... for /f "delims=" %%a in ('dir /a-d /s /b *.%1') do C:\Utils\MediaInfo.exe --Output=file://C:\Utils\MediaInfoTemplate.mit "%%a" >> MediaInfo.txt echo All Done! echo ==========================================================================
…and save it as
MediaCatalog.bat in your PATHed utility folder. Note that you are >> APPENDING to a file, so (1) you won’t see any screen output while it’s working, and (2), you better delete that file before you run it again, or it will be doubled.
See? Wasn’t that fun? And I just saved you dozens—maybe hundreds—of hours.