ReNamer:Scripts:MediaInfo
Jump to navigation
Jump to search
Script integrates MediaInfo CLI tool in order to extract meta information for a variety of audio and video file formats.
Requirements
- Download and extract MediaInfo CLI tool.
- Adjust
MediaInfoExe
constant in the script to point to a correct path of your MediaInfo CLI executable.
Code
- Author: Denis Kozlov. Date: 2018-04-09.
- Tested with ReNamer 6.8.
The script is configured to extract "Encoded_Date" meta value, but you can change it to any other tag supported by MediaInfo, by modifying the OutputParameter
constant in the script. See below for more information on supported meta tags.
The extracted meta value is used in a raw form and will replace the original file name. The resulting file name may require some additional reformatting, which can be done using the standard renaming rules.
{ Extract media meta information using MediaInfo CLI }
const
MediaInfoExe = 'C:\Tools\MediaInfoCLI\MediaInfo.exe';
OutputParameter = 'General;%Encoded_Date%';
var
Command: WideString;
Output: String;
begin
Command :=
'"' + MediaInfoExe + '"' +
' --output="' + OutputParameter + '"' +
' "' + FilePath + '"';
if ExecConsoleApp(Command, Output) = 0 then
FileName := OemToWide(Output) + WideExtractFileExt(FilePath);
end.
MediaInfo CLI Help
Built-in help commands:
MediaInfo.exe --Help
- General help information.MediaInfo.exe --Help-Output
- How to extract specific meta tags from files.MediaInfo.exe --Info-Parameters
- List of supported meta tags.