Created
May 2, 2023 02:05
-
-
Save nateify/b134efedc839e19175a9f38a28a0435c to your computer and use it in GitHub Desktop.
Simplified method of remuxing MKV with Dolby Vision P7 FEL to P8.1 with EL discarded
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 | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 input_file" >&2 | |
exit 1 | |
fi | |
input_file="$1" | |
input_dir=$(dirname "$input_file") | |
input_base=$(basename "${input_file%.*}") | |
# Extract and convert the BL+EL to BL only | |
ffmpeg -v quiet -stats -i "$input_file" -c:v copy -vbsf hevc_mp4toannexb -f hevc - | dovi_tool -m 2 convert --discard -i - -o "$input_dir/BL_RPU.hevc" | |
# Merge new HEVC and all non-video tracks from the original MKV | |
mkvmerge -o "$input_dir/$input_base.P8.mkv" \ | |
"$input_dir/BL_RPU.hevc" \ | |
--compression -1:none \ | |
-d !0 \ | |
"$input_file" | |
# Delete BL file from earlier | |
rm "$input_dir/BL_RPU.hevc" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment