VideoHelp Forum
+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. Hello, thanks in advance for any help, and Happy 2022 .

    I'm trying to learn how to batch remove-clear all of multiple .mkv files' individual tracks "Track name:"s using either MKVToolNix GUI's "Job output\When finished..." feature with either mkvpropedit.exe or a .bat file, or just a .bat file. Heck, any way other than individually . For clarity:

    1) Multiple jobs are queued in MKVToolNix GUI (v64.0.0) and will be created in a single folder.

    2) The only fields I want cleared are the individual tracks' "Track name:" (as seen in "MKVToolNix GUI\Multiplexer\Input", the bottom, left box "Tracks, chapters and tags").

    I've searched high and low but can't find a solution and if I've posted this question in the wrong place then I apologize.
    Last edited by LouieChuckyMerry; 2nd Jan 2022 at 19:58. Reason: Damn Syntax
    Quote Quote  
  2. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    This worked on a couple of test files.
    I did NOT try it with multiple audio or subtitle tracks, so I don't know the correct parameters.
    You'll need to experiment.

    Remove by stream type and number.
    e.g. the movie has 1 video, 1 audio and 1 subtitle stream.
    --track-order
    0:0, is video
    0:1, is audio
    0:2 is subs
    --track-name 1: - refers to the audio track
    --title "" - deletes the contents of the title tag - for the audio track

    Code:
    @echo off
    :: Process all MKV in a folder.
    if not exist New\*.* md New
    
    for %%a in ("*.mkv") do call :process "%%a"
    goto :end
    
    :process
    title "%~n1"
    "C:\Program Files\MKVToolNix\mkvmerge.exe" --ui-language en --output "New\%~1" --track-name 1: "%~1" --title "" --track-order 0:0,0:1,0:2
    goto :eof
    
    :end
    Cheers.
    Last edited by pcspeak; 6th Jan 2022 at 13:04.
    Quote Quote  
  3. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    I use this to wipe all metadata. And chapters.

    Code:
    @echo off
    :: Clear all metadata
    if not exist New\*.* md New
    
    for %%a in ("*.mp4", "*.mkv") do call :process "%%a"
    goto :end
    
    :process
    ffmpeg.exe -i "%~1" -map_chapters -1 -map_metadata -1 -metadata title="" -metadata comment="" -map 0 -c:v copy -c:a copy -c:s copy -y "New\%~1"
    goto :eof
    
    :end
    pause
    Cheers.
    Last edited by pcspeak; 6th Jan 2022 at 14:31.
    Quote Quote  
  4. Thanks for your reply (and patience), pcspeak. And apologies for my ignorance, but I'm not quite sure how to apply the above "scripts". Thanks for any additional information.

    EDIT: After having the time and focus, I was able to make the first .bat file work (I had to change the path for mkvmerge.exe). Thanks for that! Unfortunately I can't figure out how to make the second .bat file work. I receive the error message "'ffmpeg.exe' is not recognized as an internal or external command, operable program or batch file." I tried changing the "ffmpeg.exe" to the path of my ffmpeg.exe but receive a "Permission denied" error after many lines of text that I understand as words but not their contextual meaning .
    Last edited by LouieChuckyMerry; 12th Jan 2022 at 15:51. Reason: Information. Information.
    Quote Quote  
  5. Hi, in searching for this topic i end creating a powershell script
    Code:
    Get-ChildItem -Path . -Recurse -Filter *.mkv | ForEach-Object {
        $mkvFile = $_.FullName
        $baseMkvName = $_.BaseName
        $totalTracks = (mkvinfo.exe $mkvFile | Select-String "Track ID" | Measure-Object).Count
        Write-Host "The file $baseMkvName has: $totalTracks tracks."
    
        for ($i = 0; $i -lt $totalTracks; $i++ ) {
            $trackID = $i + 1
            $newTitle = "Track: $trackID"
    
            mkvpropedit.exe $mkvFile --edit track:$trackID --set "name=$newTitle"
    
            Write-Host $newTitle
        }
    }
    The script gets all the mkv files in the current and sub directories then iterates over each file and get the total tracks of the file, with this info the script iterates over each track and edit its name.
    I hope it helps anyone searching for ideas for this kind of topic.
    <3
    Quote Quote  
  6. cosmicuser: I just noticed your comment. Would you, please, be willing to explain to me how to use your script? I'd very much appreciate it .
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!