Last active
September 4, 2023 19:24
-
-
Save jessielw/fc325bb667dc2bb0a76c4277d5c45bf1 to your computer and use it in GitHub Desktop.
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
@echo off | |
setlocal EnableDelayedExpansion | |
REM ########################################################## | |
REM ## Path's to executable files MUST BE QUOTED! ## | |
REM ## To get path's easily, hold "Left Shift" and "Right Click" on the exe, and select "Copy as Path" | |
REM ## Then you can paste after the = (no spaces) | |
REM ## | |
set dovi_tool_path="D:\Python Stuff\HDR10Plus-Parser-Tool\Apps\dovi_tool\dovi_tool.exe" | |
set ffmpeg_path="C:\FFMPEG\bin\ffmpeg.exe" | |
REM ## | |
REM ########################################################## | |
REM ######### Job Code ################ | |
mkdir temp_working_dir | |
for %%1 in ("%~n1.*") do ( | |
echo ########## Demux Source HEVC File ########## | |
!ffmpeg_path! -i "%%1" -sn -an -map_chapters -1 -c:v:0 copy -vbsf hevc_mp4toannexb -f hevc "temp_working_dir\source_%%~n1.hevc" -hide_banner -loglevel error -stats | |
echo. | |
echo Saving source HEVC to: | |
echo "temp_working_dir\source_%%~n1.hevc" | |
echo. | |
echo ########## Demux Source HEVC File ########## | |
echo. | |
echo. | |
echo ########## Extract RPU to profile 8.1 ########## | |
!ffmpeg_path! -i "%%1" -sn -an -map_chapters -1 -c:v:0 copy -vbsf hevc_mp4toannexb -f hevc - -hide_banner -loglevel error -stats | !dovi_tool_path! -m 2 extract-rpu - -o "temp_working_dir\profile_8_RPU_%%~n1.bin" | |
echo. | |
echo Saving rpu bin to: | |
echo "temp_working_dir\profile_8_RPU_%%~n1.bin" | |
echo. | |
echo ########## Extract RPU to profile 8.1 ########## | |
echo. | |
echo. | |
echo ########## Injecting RPU into source HEVC ########## | |
!dovi_tool_path! inject-rpu -i "temp_working_dir\source_%%~n1.hevc" --rpu-in "temp_working_dir\profile_8_RPU_%%~n1.bin" -o "CONVERTED_%%~n1.hevc" | |
echo. | |
echo Saving converted HEVC to: | |
echo "CONVERTED_%%~n1.hevc" | |
echo. | |
echo ########## Injecting RPU into source HEVC ########## | |
echo. | |
echo ########## Cleaning Up Working Directory ########## | |
echo deleting "temp_working_dir" | |
RMDIR /S /Q "temp_working_dir" | |
echo ########## Cleaning Up Working Directory ########## | |
echo. | |
echo. | |
echo Now mux "CONVERTED_%%~n1.hevc" into your original input "%%1" with mkvtoolnix! x] | |
echo. | |
) | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment