Created
March 8, 2023 14:04
-
-
Save nuc/200c4a47fedd744a37e92b452f1237a6 to your computer and use it in GitHub Desktop.
Attach .cube to movie file, using YouTube's hdr_metadata tool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if both parameters have been provided | |
if [ $# -ne 2 ]; then | |
echo "Usage: $0 <video_file> <cube_file>" | |
exit 1 | |
fi | |
# Check if mkvmerge is available in PATH | |
if ! command -v mkvmerge &> /dev/null; then | |
echo "Error: mkvmerge is not available in PATH. Please add it to your PATH environment variable." | |
echo "To add it, you can run:" | |
echo " export PATH=\"\$PATH:/path/to/mkvmerge\"" | |
exit 1 | |
fi | |
# Get the directory path and file name of the input video file | |
input_dir=$(dirname "$1") | |
input_file=$(basename "$1") | |
# Get the base name of the video file | |
output_file="${input_file%.*}.mkv" | |
# Run the command | |
mkvmerge -o "${input_dir}/${output_file}" \ | |
--colour-matrix 0:9 \ | |
--colour-range 0:1 \ | |
--colour-transfer-characteristics 0:16 \ | |
--colour-primaries 0:9 \ | |
--max-content-light 0:1000 \ | |
--max-frame-light 0:300 \ | |
--max-luminance 0:1000 \ | |
--min-luminance 0:0.01 \ | |
--chromaticity-coordinates 0:0.68,0.32,0.265,0.690,0.15,0.06 \ | |
--white-colour-coordinates 0:0.3127,0.3290 \ | |
--attachment-mime-type application/x-cube \ | |
--attach-file "$2" \ | |
"$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment