MediaInfo-based extended columns & commands v0.9, released on GitHub

Hi all & happy new year,

This is not release-ready yet but decided to get some feedback, since this seems to be a very common request. I'm not too familiar with publishing stuff here, but if interest is there I can release a bundled script package with buttons, images, scripts, etc.

Over Xmas I've been experimenting with MediaInfo, Icaros, codec packs, Windows 10 native support and whatnot. There are a couple of file containers and codecs which DOpus does not natively or fully support yet, but since it does most of what I want already, I decided to help it a little bit with some custom columns and commands. Icaros exposes too little info for my taste, after getting used to Foobar2000, MP3Tag, etc. I expect no less than two billion fields to tap into. I used ffmpeg's ffprobe for another project which is also very powerful but MediaInfo is more user-friendly imo.

I've experimented a lot with the DOpus extended attributes "comments, tags/keywords, user descriptions" and none of them was suitable because I don't like the fact that DOpus stores whatever it can file-specific fields in the files if it can handle the format and the rest in ADS streams if it can't. I'd prefer them since it's integrated into Metadata pane but the inconsistency, i.e. "sometimes in-file, sometimes ADS" breaks my OCD. And I'm quite frustrated how DOpus conflates "comments" with "user descriptions" and breaks TCC/4NT compatibility if ADS is used. Then there are stupid old formats like AVI which can store keywords only up to 400 chars! Believe me there are good reasons why I don't use tags or comments. But to my surprise, FSUtil can handle arbitrary ADS streams quite well, as simple as "filename:streamname"! So here's how the script works:

Call MediaInfo for each selected file, get a JSON output in a temp file, parse and store a subset of the output in an ADS attached to every file. It obviously works only on NTFS, and as long as you activate the setting "Copy all NTFS streams" they stay put.
2021-01-03_19-05-46

Here's what I've come up so far:

You get yellow-marked columns & 5 commands (temp. added as buttons here). You might want to study the output a bit and compare what DOpus can show on the right vs on the left, but the markings mean the following:

  1. The files which do and don't have metadata extensions (ME) can show the value "yes" & "no" respectively. This column is always calculated separately without going into the rest of the multicol-method. If it's yes, there's the custom ADS attached to it.
  2. Files which have been modified after the ME has been saved can be marked as dirty.
  3. Some exotic files, such as raw AAC/AC3/DTS cannot be processed by MediaInfo either. These are normally embedded in video files and seldomly found on their own. Flac, MP3, Opus, Mka, M4a, etc. are tested fine.
  4. If the format supports ReplayGain and the file has the info, you can show it.
  5. Multi-channel information can be shown; there's also multi-track column to show if the file has multiple tracks, e.g. for different languages, director's comments, etc.
  6. The exotic files from 2 are recognized correctly.
  7. Incorrect values shown by DOpus are shown properly on the left.
  8. Display Aspect Ratio can be also shown. This is not the same as Width:Height ratio. Matroska/Mkv for example can force the player to play a 640x640 video as 640x480 and displayAR would be 1.333.

Speed: It's not a native solution, so don't expect nowhere near the same speed as DOpus shows its native columns, but with an SSD/NVME the speed is acceptable to me. I'm experimenting with caching to speed it up but correctness precedes speed at the moment.

Install: Drop/import the .JS script into your user scripts. Drop the buttons into a toolbar/menu of your choice. After that, select a bunch of video/audio files and run "Updata Metadata". To update, you don't have to delete old info first, just Update again. The file contents are not changed at all, only the data streams attached to them, but I take no responsibility and suggest you copy a few files to a temp directory and experiment with it before you do massive changes.

You also need the CLI version of MediaInfo and only the exe file. Not sure if GUI has the CLI exe bundled.

But beware: This is not a drag-and-drop script addin and there's a couple of things to adjust in the script such as MediaInfo path, ADS stream name, etc. without a prefs gui (not my top priority atm) But It requires only no or basic development skills and the places to adjust are marked clearly, look for "ADJUST AS YOU SEE FIT" in the JS code.

Debugging/Feedback: You might want to open the Output Window, switch to Other Logs view. There might be a couple errors, if the columns work ignore them :smiley: If after a refresh you still don't see the correct results try "Dump MediaInfo" or "Copy MediaInfo" commands and check if MediaInfo can parse the field you want. If it's there check with "Copy Metadata" if it's been parsed and cached as well.

During my experiments I often experienced that if MediaInfo supports a format very well, like mp4, mkv, mka, m4a, etc. but does not show an expected value, e.g. bitrate, VBR/CBR mode, etc. it is often due to older muxers. Try remuxing the file using AviDemux, MKVToolNix, FFMpeg (do not recompress, just copy the streams) and/or optimizing/rebuilding the files with Foobar2000, MP3Tag, etc. Portable versions of these programs do just as fine. This usually fixes the problem and/or fills in missing fields. If you run "Update" again, it might or might not be fixed. Good luck!

AviDemux Portable

Foobar2000
2021-01-03_20-09-37

[EDIT]
At the moment, lister columns may not be refreshed automatically during an update but I hacked a quick solution to refresh & reselect the files after an update. It works but misses some files in flat folder view.

Pretty sure DOpus gurus know this but I didn't until recently: You can use the script columns also in InfoTips & Tile View (my newest favorite now!). There's also an additional ME Formatted "column" which is best suitable for infotips and shows raw data stored in ADS. Ignore AvgKB & KB per Area fields; they're not ported to this script yet.

Buttons & Script (v0.9):
CuMediaExtenders.osp (2.5 MB)

[EDIT]:
v0.51: Added progress windows with patient help from @Leo.
v0.52: Auto-refresh added.
... many unreleased versions later..
v0.9: Far too many options and features than I had planned. GitHub page: https://github.com/cy-gh/DOpus_CuMediaExtenders

2 Likes

Ok, this has become an obsession of mine in last weeks and grown far larger than I had initially planned. Version 0.9 which is quite usable is released on Github, which has many more screenshots and feature descriptions.

GitHub page: https://github.com/cy-gh/DOpus_CuMediaExtenders
OSP at GitHub: https://github.com/cy-gh/DOpus_CuMediaExtenders/releases/tag/v0.9

CuMediaExtenders.osp (2.5 MB)

From the README.md:

CuMediaExtenders

Video & audio extended script fields & columns for the marvellous Directory Opus file manager, with MediaInfo & NTFS ADS backend.

CuMediaExtenders is a script-addin for DOpus for video and audio files, using MediaInfo and NTFS ADS as its backend.
It complements & enhances DOpus built-in fields, instead of completely replacing them.

As of v0.9/20210113 you get:

  • 15 commands incl. custom icons
  • 41 columns/script fields
  • DCF menu with all available commands
  • Sample JSON file to customize column labels (requires Script or DOpus restart)
  • PSD template used to create the icons

It has extensive configuration options with descriptions and include samples in config section 'Reference Only'.

Column labels are customizable with a JSON file, a sample file is in distro (extract OSP if not visible).

Video & Audio Codec, # of Audio Channels, Duration groups and Resolution fields are customizable without modifying the script.

'Dirty' files, i.e. files which are changed since writing to ADS, can be detected.

Seen files are cached in DOpus memory, to speed up reading process (deactivatable).

Progress dialog with Pause/Resume & Abort is supported.

4 additional buttons are supplied which can toggle on/off field groups, which are customizable.

Supported Formats (as of v0.9)

Containers && Codecs I have tested so far:

​ MKV, MP4, AVI, FLV, WEBM, 3GP,

​ M4A, M4B, MKA, MP3, MP2, MP1, FLAC, AC3, AAC, DTS, TrueHD (Dolby Atmos),

​ Wave, Wave64, ALAC, TAK, TTA, DSD, Ogg Vorbis, AIFF, AMR, WavPack, WMA Lossy & Lossless, MusePack

....and any file as long as MediaInfo reports at least a video or audio track.

Available Fields

Columns are by default prefixed with ME (Media Extensions); labels can be customized via external config file.

Note although some of these fields also exist in DOpus, they are not available for all container & codec types

Field (not IDs) Desc
HasADS/IsAvailable File has Metadata ADS (calculated separately, not Multicol) [++]
NeedsUpdate/Dirty File has been changed since Metadata ADS has been written [++]
VCodec Video codec (only 1st video stream) [+]
ACodec Audio codec (only 1st audio stream) [+]
TBitrate Total bitrate [++]
VBitrate Video bitrate (only 1st video stream) [+]
ABitrate Audio bitrate (only 1st audio stream) [+]
VCount Number of video streams [++]
ACount Number of audio streams [++]
TCount Number of text (subtitle) streams [++]
OCount Number of other (chapters, menus...) streams [++]
ABitrate Mode VBR/CBR if available (ABR is principally recognized as VBR) [++]
TDuration Total container duration [+]/[++]
VDuration Video duration [+]/[++]
Auration Audio duration [+]/[++]
Duration (Combo) Combined duration, only a single one is displayed unless any of 3 differs from each other (5s tolerance), i.e. detects mismatching streams [++]
Multi-Audio File has multiple audio streams (yes/no) [++]
Audio Channels Number of channels in 1st audio track, e.g. 2.0, 5.1, 7.1 [+]
ReplayGain File has ReplayGain (RG) info stored (some format support RG but MediaInfo does not parse it) [++]
Audio Compression Mode Lossy/Lossless [++]
AspectRatio (Raw) Video aspect ratio (AR), i.e. width:height, e.g. 1.333, 2.35, etc. [++]
AspectRatio (Disp) Video display AR if the format supports it and file has a different AR than its raw AR [++]
AspectRatio (Combined) Combined video AR, only a single AR is displayed, if its display AR differs from raw AR, it's shown in parentheses [++]
Gross byterate Gross average KB, kilobytes per second, for the file, simply filesize:duration [++]
Bits per Pixel Video average bits per pixel, i.e. video bitrate/(width*height); only 1st video stream [++]
Dimensions Video dimensions [+]
Resolution 240p, 360p, 480p, 720p, 1080p, 4K, 8K - Customizable, can append '(Vertical)' for vertical videos [++]
Frame Rate Video frame rate [+]
Subtitle Language Subtitle language if available (only 1st text stream) [++]
Encoded Library Library used to encode the video if available, incl. technical info [++]
Encoded Lib Name Library used to encode the video if available no technical info [++]
VCodec ID Video Codec ID (raw), if available [++]
ACodec ID Audio Codec ID (raw), if available [++]
AFormat Version Audio Format Version, if available [++]
AFormat Profile Audio Format Profile, if available [++]
Encoder App Container Encoder App, if available [++]
ADS (Formatted) Formatted ADS data (always as JSON), suitable to show in InfoTips [++]
ADS (Raw) Unformatted ADS data (always as JSON), only for sake of completeness, not very suitable as a column or InfoTip [++]
Helpers 3 helper columns for the container, video & audio tracks, which you can use to adjust display Codec names [++]

[+] Recognizes more formats and/or is more accurate than DOpus

[++] No DOpus counterpart

Unlike DOpus, output of following columns are user-customizable (editing source code is also another option):

  • VCodec
  • ACodec
  • Audio Channels
  • Resolution

Although there are no fields for the following, they are stored and available in ADS (see section Adding/Adjusting Fields):

  • Overall Bitrate Mode
  • Additional & Extra info fields for Container, Video, Audio & Text
    These container- and codec-specific fields can contain a lot information e.g. ReplayGain, used encoding settings, date-time of encoding... which can be used show new fields/columns or adjust existing ones.
  • Video Stream Size
  • Audio Stream Size
  • Audio Format Settings Mode
  • Audio Sampling Rate

Note some of the fields (e.g. sampling rate) above are already supported by DOpus well close to 100%, albeit not for all containers & codecs.

Any other info should be used from DOpus builtin fields.

Available Actions

  • Update Metadata: Create/Update Metadata ADS for selected file
  • Delete Metadata: Delete attached Metadata ADS of selected file
  • Clear Cache: Clear in-memory DOpus cache for Metadata read from ADS (see FEATURES)
  • Copy Metadata: Copy Metadata ADS of selected files to clipboard
  • Dump Metadata: Dump Metadata ADS of selected files to DOpus Output window
  • Copy MediaInfo: Run MediaInfo anew and copy its output to clipboard
  • Dump MediaInfo: Run MediaInfo anew and dump its output to DOpus Output window
  • Estimate Bitrate: Calculate bitrate using a list of target 'bitrate/pixel' values
  • Toggle Essential: Toggle a user-configurable list of 'essential' columns, can toggle DOpus columns
  • Toggle Optional: Toggle a user-configurable list of 'optional' columns, can toggle DOpus columns
  • Toggle Other: Toggle a user-configurable list of 'other' columns, can toggle DOpus columns
  • Toggle Verbose: Toggle a user-configurable list of 'verbose' columns, can toggle DOpus columns
  • Validate Config: Validate current user configuration

A preconfigured menu button with all available actions is in distro (extract OSP if not visible); see screenshots below.

3 Likes