@NewPlaza said:
I know audio lang is important for auto-selecting subtitles and such but what about the language of the video. Does PLEX use this to determine anything?
Not at all, to my knowledge.
And how does that coincide with the lang of the audio?
It is completely separate and has no effect at all in Plex.
I only need to change the files where Audio Language is unknown, and cant risk foreign movies is modified. Could anyone please verify that it only changes unknown tags?
Does anyone have a script that checks if the language is Unknown before setting it to Eng?
I am hoping to find a script I can call from Sonarr/Radarr on Download, and conditionally update the language flag only if it needs to and only the correct stream.
Yep. Copy the below and save as WhatEverYouLike.cmd…
@ECHO OFF
ECHO.
ECHO Set all Undetermined(und) audio language to English(eng) in current folder.
ECHO.
ECHO.
FOR %%A IN (*.mkv) DO (
FOR /F %%I IN ('mkvmerge.exe --identify "%%A" ^| FIND /C "Track ID"') DO (
IF %%I GTR 0 (
FOR /L %%T IN (0,1,%%I) DO (
mkvmerge.exe -I "%%~dpnxA" | FINDSTR /C:"Track ID %%T: audio" | FINDSTR /C:"language:und">NUL
IF NOT ERRORLEVEL 1 ECHO Undetermined audio language found. & ECHO "%%~nxA" & mkvpropedit.exe "%%~dpnxA" -e track:%%I -s language=eng & ECHO. & ECHO. & ECHO.
)
)
))
ECHO The end...
PAUSE
EXIT
You will need the programs mkvmerge.exe and mkvpropedit.exe and must be placed in the same location as this command script… This will scan the current directory and set all *.mkv files but you can modify to suit your needs… Good luck.
EDIT: Forgot to include the versions I was using.
mkvmerge v7.8.0
mkvpropedit v7.8.0
I imagine the newest versions would work but I haven’t tested.
Yep.
Replace the first loop FOR %%A IN (*.mkv) DO ( to FOR /R %%A IN (*.mkv) DO (
Just bare in mind that even though this will edit the headers and is relatively fast(milliseconds/file) this could take a VERY long time to complete if you run on a NAS or network share with thousands of files. It can be painstakingly slow if your shares have a 10/100 connection.
fairly new to scripting on windows, but I’ve made a Windows VM to run the script on.
Still looking for a way to refencence MKVToolNix folder, instead I copy the binaries to the folder my script is run.
IF EXIST "%ProgramFiles%\MKVToolNix\mkvpropedit.exe" SET MKVEdit=C:\PROGRA~1\MKVToolNix\mkvpropedit.exe
IF EXIST "%ProgramFiles(x86)%\MKVToolNix\mkvpropedit.exe" SET MKVEdit=C:\PROGRA~2\MKVToolNix\mkvpropedit.exe
IF EXIST mkvpropedit.exe SET MKVEdit=mkvpropedit.exe
IF EXIST %MKVEdit% GOTO:TagRename
ECHO MKVToolNix not installed or not found.&PAUSE&EXIT
:TagRename
The rest of your code goes here.......
Yes. You’ll have to copy it into each subfolder and execute it there.
If you find an expert in shell scripting, you probably can modify the script to work recursively – but this is very dangerous IMHO.
If you have files with more than one audio language, working recursively can cause a lot of damage in a very short time.
I second @OttoKerner concern on that. As he stated, you can “destroy” thousands of files in just a few seconds. And maybe the worst of that would be correcting them back. I have many scripts that do multiple tasks but even then, every file is treated differently… So, none of my scripts are recursive.
Windows Powershell functions to convert video files with mkvmerge from mp4 and avi to mkv and set all mkv default audio and video language to your desired language with mkvpropedit all in batch to be used for your PLEX server or something else.