Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo on
- setlocal enabledelayedexpansion
- rem Set the directory containing the files
- set "input_directory=C:\Video"
- rem Loop through each file in the directory
- for %%F in ("%input_directory%\*.mkv") do (
- rem Extract file name and extension
- set "filename=%%~nF"
- set "extension=%%~xF"
- rem Check if the file name already contains "-ac3" at the end
- set "excludeFile="
- echo !filename! | find /i "-ac3" > nul && set excludeFile=1
- if not defined excludeFile (
- rem Copy over all video (c:v copy) and subtitles (-scodec copy), and copy over all audio streams (-map 0), converting from AAC to AC3 (-c:a ac3)
- rem Plex will attempt to reencode AAC to AC3 and will add back in header color info that will cause the oversaturation issue
- ffmpeg -i "!input_directory!\!filename!!extension!" -flags +global_header -movflags faststart -c:v copy -c:a ac3 -map 0 -scodec copy "!input_directory!\!filename!-ac3!extension!"
- rem Strip header color information
- mkvpropedit "!input_directory!\!filename!-ac3!extension!" --edit track:v1 --delete colour-primaries --delete colour-range --delete colour-matrix-coefficients --delete colour-transfer-characteristics --delete chroma-siting-horizontal --delete chroma-siting-vertical
- )
- )
- echo All operations completed.
- pause
Advertisement
Add Comment
Please, Sign In to add comment