mkvnote
is a Bash script designed to embed metadata tags into Matroska (MKV) video files using pre-defined sets of key-value pairs. It supports two metadata profiles, JPC
(Johnson Publishing Company) and NMAAHC
(National Museum of African American History and Culture), which have specific fields associated with them. The script can be run interactively or in batch mode using a CSV file to automate the tagging of multiple files.
- Supports two tag profiles:
JPC
andNMAAHC
- Interactive dialog interface for manual tagging
- Batch processing of MKV files via a CSV file
- Embeds custom metadata tags into MKV files using the
mkvpropedit
tool
Ensure you have the following installed on your macOS system:
-
Bash Shell: The script is designed to be executed in a Bash environment.
-
Homebrew: If you don't have Homebrew installed, you can install it using:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
MKVToolNix: Required to embed the tags into MKV files. Install it via Homebrew:
brew install mkvtoolnix
-
swiftDialog: Required for the interactive dialog mode. Download and install it from: https://github.com/swiftDialog/swiftDialog/releases
-
xmlstarlet: Required to handle XML operations. Install it via Homebrew:
brew install xmlstarlet
The script can be used in two primary ways:
- Interactive Tagging via Dialog
- Batch Tagging via CSV File
To run the script interactively and manually input metadata for a single MKV file, use the following syntax:
./mkvnote [-p|--profile <profile>] /path/to/file.mkv
-p|--profile
: The profile to use for tagging. Must be eitherjpc
ornmaahc
./path/to/file.mkv
: The MKV file that you want to tag.
If the profile is not provided via the command line, the script will prompt you to select one interactively.
./mkvnote -p jpc /home/user/videos/sample.mkv
To tag multiple MKV files in batch mode using a CSV file, use the following syntax:
./mkvnote /path/to/file.csv
- The CSV file must contain the metadata for each file, with a column for the filename and other columns for metadata tags.
filename,director,rating
/home/user/videos/sample1.mkv,Dave,PG
/home/user/videos/sample2.mkv,Blake,G
The script will read each file from the CSV, apply the metadata tags, and embed them into the respective MKV files.
COLLECTION
TITLE
CATALOG_NUMBER
DESCRIPTION
DATE_DIGITIZED
ENCODING_SETTINGS
ENCODED_BY
ORIGINAL_MEDIA_TYPE
DATE_TAGGED
TERMS_OF_USE
_TECHNICAL_NOTES
_ORIGINAL_FPS
Includes all tags from the JPC
profile, with an additional tag:
_TAGTAG
In both interactive and batch modes, the tags are embedded into the MKV file as metadata using mkvpropedit
.
- If any files referenced in the CSV are missing or not found, the script will output an error and stop processing. You can review the list of missing files in the error message.
- If you provide an invalid option or fail to select a valid profile, the script will display an error message and exit.
0
: Success1
: Error during file processing (e.g., missing files, invalid input)
If you would like to contribute or suggest improvements, please submit a pull request or open an issue.