That was me trying a different folder structure... I used the default as well... for x64 system "programs (x86)...." same issue. I tried it on a win 8 , win 7, and server 2008 box all with Default MkVtoolnix locations and no luck .
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 31 to 45 of 45
Thread
-
-
mkvtoolnix location : C:\Program Files (x86)\MKVToolNix
Start folder : "StartFolder=W:\Movies" "movies under here are .MKV withing all in their own subfolder
Variables Command Set output:
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\Dave\AppData\Roaming
asl.log=Destination=file
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=OFFICE
ComSpec=C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Users\Dave
JAVA_PLUGIN_WEBCONTROL_ENABLE=1
LOCALAPPDATA=C:\Users\Dave\AppData\Local
LOGONSERVER=\\MicrosoftAccount
NUMBER_OF_PROCESSORS=8
OPENSSL_CONF=C:\OpenSSL-Win32\bin\openssl.cfg
OS=Windows_NT
Path=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Clie
t\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C
\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\Syste m32\WindowsPowerShell\v1.0\;C
\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files
Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\In
el(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Ma
agement Engine Components\IPT
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WS F;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=3a09
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\WINDOWS\system32\WindowsPowerShell \v1.0\Modules\
PUBLIC=C:\Users\Public
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\Users\Dave\AppData\Local\Temp
TMP=C:\Users\Dave\AppData\Local\Temp
USERDOMAIN=OFFICE
USERDOMAIN_ROAMINGPROFILE=OFFICE
USERNAME=Dave
USERPROFILE=C:\Users\Dave
windir=C:\WINDOWS -
Aslo no matter where i set the folder to scan from even with no sub-folders it gets the same issue.
-
I made a video of myself changing the default audio/subtitle track using a batch file. The same tactic can be used to remove the track.
https://www.youtube.com/watch?v=bHTlQ61AaIE
The batch file will only work if each video has the same audio/subtitle options, but it's the best I've come up with using a batch file. -
For very simple tasks you do not need a script, just only one line in the cmd window. Example to remove the second audio track (track ID 2) and the second subtitle track (track ID 4):
Code:for %a in (*.mkv) do @mkvmerge -o "output/%~a" --audio-tracks !2 --subtitle-tracks !4 "%~a"
Last edited by Endoro; 2nd Feb 2014 at 04:12.
-
Thanks, this worked great but I had to change 1 line near the end to
Code:FOR %%a IN ("%MKVFile%") DO SET "MKVBackupFile=%MKVBackupFile%"
I have limited experience in batch programming for DOS but also changed the beginning of the script to be able to drag and drop a file the batch file and then looped it to handle multiple files.
like this:
Code::LOOP FOR /f "DELIMS=" %%a IN ('DIR /b /s /a-d %1') DO SET "MKVFile=%%~a"&CALL:scanmkv SHIFT IF NOT (%1)==() GOTO LOOP GOTO:EOF
Last edited by Pirum; 24th Sep 2014 at 01:40.
-
Ok.
So i have had a turn at modding the script too.
a. I've added a Path function, so you only need to have the ".bat" file located in the folder you are working on, you wont need to have the mkvmerge.exe executable file there anymore. You will need to modify this path setting to the location of your mkvmerge.exe program.
Code:PATH "mkvmerge=C:\Program Files\MKVToolNix\mkvmerge.exe"
Code:rem delete backup mvk file ECHO(Deleteing "%MKVBackupFile%" DEL %MKVBackupFile%
Code:@ECHO OFF &SETLOCAL TITLE Recursive remove audio and subtitle tracks by language from MKV video files rem search for MKVs in all "StartFolder\Subfolders", not in "Startfolder" itself SET "StartFolder=." rem example to keep English and German audio tracks, please note the colon in front of the language code SET "AudioTracksToKeep=:eng" rem example to keep Spanish and French subtitle tracks, please note the colon in front of the language code SET "SubsTracksToKeep=:eng" rem the file name variable must be global for some reasons SET "MKVFile=" PATH "mkvmerge=C:\Program Files\MKVToolNix\mkvmerge.exe" FOR /f "DELIMS=" %%a IN ('DIR /b /s /a-d "%StartFolder%\*.mkv"') DO SET "MKVFile=%%~a"&CALL:scanmkv GOTO:EOF :scanmkv SETLOCAL ECHO( ECHO(Scanning "%MKVFile%" for unwanted tracks. (FOR /l %%b IN (1 1 45) DO <nul SET /p "=-")&ECHO( SET /a AudioTrackCount=0 SET /a NumberKeepAudio=0 SET /a NumberDiscardAudio=0 rem get the number of audio tracks FOR /f %%a IN ('mkvmerge --ui-language en -i "%MKVFile%"^|FINDSTR /rbic:"Track ID [0-9][0-9]*: audio"') DO SET /a AudioTrackCount+=1 ECHO(Number of audio tracks: %AudioTrackCount% rem always keep at least one audio track IF %AudioTrackCount% LSS 2 GOTO:subscan rem get the audio tracks to keep SET "KeepAudioSearchString=%AudioTracksToKeep::= language:%" FOR /f "TOKENS=3DELIMS=: " %%a IN ('mkvmerge --ui-language en --identify-verbose "%MKVFile%"^|FINDSTR /rbic:"Track ID [0-9][0-9]*: audio"^|FINDSTR /ri "%KeepAudioSearchString%"') DO ( SET /a NumberKeepAudio+=1 CALL SET "AudioIdentKeepLine=%%AudioIdentKeepLine%%,%%a" ) IF NOT DEFINED AudioIdentKeepLine SET "AudioIdentKeepLine= ^<none^>" ECHO(ID of %NumberKeepAudio% track(s) to keep: %AudioIdentKeepLine:~1% IF %NumberKeepAudio%==0 GOTO:subscan rem get the audio tracks to reject FOR /f "TOKENS=3DELIMS=: " %%a IN ('mkvmerge --ui-language en --identify-verbose "%MKVFile%"^|FINDSTR /rbic:"Track ID [0-9][0-9]*: audio"^|FINDSTR /riv "%KeepAudioSearchString%"') DO ( SET /a NumberDiscardAudio+=1 CALL SET "AudioIdentDiscardLine=%%AudioIdentDiscardLine%%,%%a" ) IF NOT DEFINED AudioIdentDiscardLine SET "AudioIdentDiscardLine= ^<none^>" ECHO(ID of %NumberDiscardAudio% track(s) to reject: %AudioIdentDiscardLine:~1% IF %NumberDiscardAudio%==0 GOTO:subscan :subscan SET /a SubsTrackCount=0 SET /a NumberKeepSubs=0 SET /a NumberDiscardSubs=0 rem get the number of subtitle tracks FOR /f %%a IN ('mkvmerge --ui-language en -i "%MKVFile%"^|FINDSTR /rbic:"Track ID [0-9][0-9]*: subtitles"') DO SET /a SubsTrackCount+=1 ECHO(Number of subtitle tracks: %SubsTrackCount% IF %SubsTrackCount% EQU 0 GOTO:muxing rem get the subtitle tracks to keep SET "KeepSubsSearchString=%SubsTracksToKeep::= language:%" FOR /f "TOKENS=3DELIMS=: " %%a IN ('mkvmerge --ui-language en --identify-verbose "%MKVFile%"^|FINDSTR /rbic:"Track ID [0-9][0-9]*: subtitles"^|FINDSTR /ri "%KeepSubsSearchString%"') DO ( SET /a NumberKeepSubs+=1 CALL SET "SubsIdentKeepLine=%%SubsIdentKeepLine%%,%%a" ) IF NOT DEFINED SubsIdentKeepLine SET "SubsIdentKeepLine= ^<none^>" ECHO(ID of %NumberKeepSubs% track(s) to keep: %SubsIdentKeepLine:~1% IF %NumberKeepSubs%==0 GOTO:muxing rem get the subtitle tracks to reject FOR /f "TOKENS=3DELIMS=: " %%a IN ('mkvmerge --ui-language en --identify-verbose "%MKVFile%"^|FINDSTR /rbic:"Track ID [0-9][0-9]*: subtitles"^|FINDSTR /riv "%KeepSubsSearchString%"') DO ( SET /a NumberDiscardSubs+=1 CALL SET "SubsIdentDiscardLine=%%SubsIdentDiscardLine%%,%%a" ) IF NOT DEFINED SubsIdentDiscardLine SET "SubsIdentDiscardLine= ^<none^>" ECHO(ID of %NumberDiscardSubs% track(s) to reject: %SubsIdentDiscardLine:~1% IF %NumberDiscardSubs%==0 GOTO:muxing :muxing IF %NumberDiscardAudio%==0 IF %NumberDiscardSubs%==0 ECHO(Nothing to do.&EXIT /b IF %NumberDiscardAudio% NEQ 0 SET "CommandLine=-a %AudioIdentKeepLine:~1%" IF %NumberDiscardSubs% NEQ 0 SET "CommandLine=%Commandline% -s %SubsIdentKeepLine:~1%" rem make a backup copy of the MKV FOR %%a IN ("%MKVFile%") DO SET "MKVBackupFile=%%~na.bak%%~xa" ECHO(Building "%MKVBackupFile%" REN "%MKVFile%" "%MKVBackupFile%" || (ECHO(Error renaming to "%MKVBackupFile%"&EXIT /b) rem build the new MKV FOR %%a IN ("%MKVFile%") DO SET "MKVBackupFile=%MKVBackupFile%" ECHO(REMuxing "%MKVFile%" mkvmerge -o "%MKVFile%" %Commandline% "%MKVBackupFile%" rem delete backup mvk file ECHO(Deleteing "%MKVBackupFile%" DEL %MKVBackupFile% EXIT /b
Last edited by yobrevar; 25th Jul 2015 at 02:54. Reason: attachment
-
Hey yobrevar,
When I try to run your version, I get an error saying something along the lines of no command, program, bat file for mkvmerge. I've confirmed that I have pasted the correct path into the mkvmerge.exe PATH line.
I'm trying to run it on Windows 10, 64 Bit.
Any suggestions? -
I've created a simple .net Application that will recursively go through the destination folder, check the lang file on all tracks (video/audio/subtitles) on all mkv files and remove any that aren't specified. It makes a temporary file called Work_filename and then deletes the original and renames the fixed file.
Example
RemoveunwantedTracks.exe -d "Folder to look in''s full path" -m "Folder where mkvmerge is" -l language wanted
RemoveunwantedTracks.exe -d "d:\TV Shows\TV Show 1" -m "D:\Tools\MKVtoolnix" -l eng
You can specify multiple directories and languages if wanted. also can turn off recursive mode. (running with -h will give you a list of commands.
Hope this helps anyone. Enjoy.
-Chuck DDBLast edited by ChuckDDB; 11th Jul 2016 at 23:05. Reason: Misspelling
-
-
LOVE this program! Thank you for making it!
1. A couple small things I might add to it; when there's some error, for example, if the path to mkvmerge folder is bad, it shows the crash dialog, then pressing continue on it show all of the ugly dev error code that looks like jibberish to your average Joe. Adding a Try/Catch to that, and changing the error stuff to Laymen's Terms (i.e. "Bad Path to the MKVTools Folder") instead would be much nicer.
2. When doing the /h, adding in the description, and example usage (even just pasting exactly what you wrote in your post on it) in addition to what it already shows, would be great. Then it's all in one handy lil package. No ReadMe.txt or anything needing to sit next to it in it's folder.
3. Log all changes to a log file, so they can be reviewed later.
Thanks!
P.S. If you don't want to take time out to do it, I can do it if the source is available.Last edited by NukeyDoo; 23rd Sep 2016 at 00:06.
-
Sorry, but I haven't been on here for awhile.
Here is the Source Code if anyone wants to change anything, I believe something was changed in mkvmerge v15 that broke the removal of mismatched subtitle languages, but I haven't had time to look into anything.
Enjoy (It's a VS 2015 Solution)
-Chuck -
Pretty simple with current version of mkvmerge. Just tell it to copy only english audio/subtitle tracks to the new mkv file. For english, use eng. For any other language, refer to ISO639-2 language code
Using programming language agnostic concept . Variables are between {} :
Code:set {audio} as any of these :
for english audio = -a "eng" for english and french audio = -a "eng,fre"
set {subtitle} as any of these :for english sub = -s "eng" for english and french sub = -s "eng,fre" for no sub (delete all) = --no-subtitles to keep all subs, let variable empty.
mkvmerge --title "[filename|noext ]" --output "path\new file with english tracks only.mkv" {$audio} {$subtitle} "(" "file to process.mkv" ")"
To sum this up, the simplest command to use to keep english audio track only would be :
Code:mkvmerge --output "path\new file with english tracks only.mkv" -a "eng" "file to process.mkv"
Last edited by freMea; 28th Dec 2018 at 12:37.
Similar Threads
-
How to remove one of two audio tracks in a mkv file?
By BooSnow in forum AudioReplies: 4Last Post: 18th Oct 2020, 10:00 -
Changing Container from MOV to MP4 in bulk?
By anonymous99 in forum Video ConversionReplies: 13Last Post: 28th May 2012, 09:24 -
Remove Tracks from MKV?
By therock003 in forum Video ConversionReplies: 11Last Post: 16th Nov 2011, 03:13 -
Remove the mkv container(or convert) to reduce lag
By JoeJoeJoe in forum Video ConversionReplies: 10Last Post: 21st Jul 2010, 16:05 -
How do you move files from .ogm container to .mkv container?
By VidHunter in forum MacReplies: 0Last Post: 8th Mar 2008, 18:19