How to remove tag spam and set language in several MKV files at once

Maybe set video to undetermined(und) .

Tagging the language of the video stream has no direct consequences in Plex. (nor other players that I know of).
It is useful though, to indicate the language of burned-in subtitles or the general language of signs on screens or the credit roll.

1 Like

Yeah. I know… Just looks tacky to me anyways.

I never saw it used that way and that would be great if everyone did it that way.

any way to also include subfolders?

thanks

There is, but I won’t explain it. It is mentioned above a few times. It is a great way to mess up a whole library pretty quickly.

Thanks

Maybe you can tell what causes this error?

C:\Users\Admin\Videos\Plex\Plex Movie\Movies>(
echo Mirrors 2 (2010) [480p]
 "C:\Program Files\MKVToolNix\mkvmerge" -o "Mirrors 2 (2010) [480p].mkv" --language 0:eng --language 1:ger "Mirrors 2 (2010) [480p].avi"
)
Mirrors 2 (2010) [480p]
mkvmerge v37.0.0 ('Leave It') 64-bit
Error: The file 'Mirrors 2 (2010) [480p].avi' could not be opened for reading: open file error.

Thanks

EDIT: All good. I had an syntax error :frowning:

Hi, OttoKerner/all~

Has anyone found a way to preserve the timestamp of the file being edited when using mkvpropredit?

From this discussion over on StackOverflow, it appears that, on Linux, you could:

  1. Create a dummy .txt file (or any file)
  2. touch -r the .txt file with the .mkv file you are about to modify to transfer the timestamp of the .mkv over to the .txt file
  3. Perform your mkvpropedit modifications
  4. touch -r the .mkv with the .txt to transfer the timestamp back

The trouble is, I’m on Windows and a solution there would be preferred.

…it’d be nice if there was just a flag you could pass in to mkvpropedit to preserve the timestamp, but so far I haven’t been able to find one.

Any help appreciated.

Thanks, Nathan

In my experiments, the file’s datetime stamp is maintained when it’s edited with mkvpropedit.

Interesting.

I just downloaded the latest version of MKVToolNix (42.0.0 portable) and mkvpropedit.exe from that package is not preserving timestamps for me.

In the meantime, I did find that the Linux approach can be achieved in Windows by using the old CoreUtils for Windows package, and I figure I might as well share what I’ve come up with.

Steps (that avoid having to install the whole package):

  1. Download the CoreUtils binaries .zip
  2. Download the CoreUtils dependencies .zip
  3. Extract touch.exe from the binaries .zip
  4. Extract the two .dll files from the dependencies .zip
  5. Put the .exe and the .dll files into a single location
  6. Create a dummy .txt file (in my case, _TimestampTransfer.txt) in the same folder as your .mkv files
  7. Place a .bat script along the lines of the following in the same folder as your .mkv files:
@echo off
cd /d "%~dp0"
for /r %%i in (*.mkv) do (
  echo Processing "%%i"
  "C:\Path\To\touch.exe" -r "%%i" "_TimestampTransfer.txt"
  "C:\Path\To\mkvpropedit.exe" "%%i" --tags all:"" --delete title --delete-attachment mime-type:image/jpeg --delete-attachment mime-type:image/pjpeg --delete-attachment mime-type:image/png --delete-attachment mime-type:text/plain --edit track:v1 --delete name
  "C:\Path\To\touch.exe" -r "_TimestampTransfer.txt" "%%i"
  echo.
)

pause

This script was customized for my needs, based on what I found in my .mkv files. It:
  1. --tags all:"" - removes any tags
  2. --delete title - deletes any title in the general info section of the file
  3. --delete-attachment - deletes any .jpg, .png, and .txt attachments
  4. --edit track:v1 --delete name - deletes any nested title in the video stream itself
  5. for /r %%i in (*.mkv) do ( - the /r tells the script to recurse down in to subfolders and processes any .mkv files it finds there

For #4, I found that I had these “nested titles” in a number of my video files and that Plex would read them if they were there and there was no title in the general info of the file.

Cheers,
Nathan

is there a proper way to select just the “UND” tracks and change them to “GER” under linux?

#!/bin/bash

find . -name "*.mkv" -exec mkvpropedit {} --edit track:a1 --set language=ger \;

#exit 0

done

Thanks

Hey @OttoKerner, for your post about the script for multiple files. It’s quite a long discussion, but I was surprised to see that you ask people to take an existing script and modify it based on the content of the videos. Have you every thought of approaching it from the opposite direction, where you take the command-line script that WOULD BE run when you use the GUI of MKVTools to modify a single file, then edit that instead? That would ensure that the script is customized for the EXACT video/audio/tag/etc makeup for each file.

I use a script that is pretty small:

for %%a in (*.*) do [PASTE HERE]


--output ^"D:\Temp\%%a^"
^"^(^" ^"%%a^" ^"^)^"

I place a copy of this script file into the folder containing my files. After a quick check to ensure that the video/audio/sub tracks are all in the same order (I have been burned by one group’s season pack changing the order of eng/jap sub tracks mid-season once), I pick one episode and drop it into MKVToolNix GUI. Enable/Disable any items I do/do-not want. Change labels. Change languages of whatever is wrong. Then, without actually running it, go to the menu, and click Multiplexer > Show Command Line.

Copy the entire code block there, and paste into my script file where it says [PASTE HERE]. Cut the “–output” line, and paste over the “– output OUTPUTPATH” block of code. Cut the line in my script that has all those up-arrows, and paste over the ENTIRE path to the source file. If I didn’t leave anything out or paste wrong, the script runs perfectly and outputs files of the exact same name into the roof of my D:/Temp folder.

A quick double check that the files are formed right and have the correct tracks (I checked before I did the script, but - again - I have been burned in the past so I check often) and I’m done.

1 Like

I wanted to add to pieces of information to this tread:

  1. Regarding Bulk updates of MKV (and also MP4) files, I made good experiences with MP3Tag (Windows). Although it is geared towards tagging MP3 files, it works equally well on video files e.g. for removing Title, Year, Genre and also has an option to Remove Cover.
    It scans whole directory trees for supported files and you can then designate a subset on which to perform bulk edits.
    It has been mentioned here and here before, but I wanted to give this tool a bump, as it does most of what the scripts above aim to do, but with a good GUI.
    It can be freely used without restrictions but asks for a donation. (I have no affiliation with the author)

  2. MP3Tag does not handle language tags on the videos or audio tracks, though. I am not happy with the undiscerning “bulk delete all” or “bulk set to language X” approaches discussed above. So I wanted to shamelessly promote a feature request I created recently: Automated detection and handling of audio and subtitle languages Please comment/vote if this topic is close to your heart as well.

1 Like