Sorry to revive a relatively old thread, though is there any way to do this with your script with mp4 files?
Sorry to revive a relatively old thread, though is there any way to do this with your script with mp4 files?
Scroll upwards. There are several links and scripts.
Oh I have. I’m looking for a solution that only changes “Unknown” mp4 files, though none of the scripts in this thread indicate how to check the current language for mp4 files- only mkv. Unless I’m not seeing it…
Thanks!
It does not do anything, it just starts and then says The End… and nothing is changed. My files audio track is still UND
I edited it to a simpler one that jsut reaplces all audio tracks 1, and then it worked
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 (mkvpropedit.exe “%%~dpnxA” -e track:a1 -s language=eng & ECHO. & ECHO. & ECHO.
)
)
))
ECHO The end…
PAUSE
EXIT
A little late to the party but here is some python code that will help. Install python, Make sure python, MP4box, and exiftools is in path.
import os
import subprocess
def complete_func(filepath):
si = subprocess.STARTUPINFO()
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
command = ("exiftool", "-MediaLanguageCode", filepath)
process = subprocess.Popen(command, shell=False, startupinfo=si, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
process.wait()
language = process.stdout.read()[-5:-2].decode('utf-8')
if language == 'und':
command2 = ("MP4Box", "-tmp", os.getcwd(), "-lang", "eng", filepath)
process2 = subprocess.Popen(command2, shell=False)
process2.wait()
for root, dirs, files in os.walk(os.getcwd()):
for file in files:
if file.endswith(".mp4"):
filepath1 = os.path.join(root, file)
complete_func(filepath1)
Easiest way, open notepad and save this code in notepad. Change extenstion to .py. Drop this in a directory you want to sort the language and double click the file. If python is installed and the programs are in path it’ll work away.