Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
![]() |
#1 | Link |
Registered User
Join Date: Jan 2013
Posts: 10
|
Batch file editing using MKVToolNix
So basically what I'm trying to do is to recursively search out MKV and AVI files in a particular folder and change their apsect ratios to 16:9.
Here is the folder/files setup: MainFolder\ MainFolder\file1.mkv MainFolder\file2.avi ... MainFolder\Subfolder1\ MainFolder\Subfolder1\file1.mkv MainFolder\Subfolder1\file2.avi ... MainFolder\Subfolder2\ MainFolder\Subfolder2\file.mkv ... Here is what I have so far in my batch file (fixAspect.bat): Code:
@echo off SET mkvmerge="C:\Program Files (x86)\MKVToolNix\mkvmerge.exe" CD [C:\...\MainFolder] FOR /R %%I IN (*.mkv) DO (mkvmerge -v -o "%%~nI (remux).mkv" "--aspect-ratio 16/9" "%%~I") PAUSE |
![]() |
![]() |
![]() |
#4 | Link |
Registered User
Join Date: Dec 2002
Posts: 5,565
|
You can either set the values in pixels (most common), like e.g.:
mkvpropedit "%%I" --edit track:v1 --set display-width=1920 --set display-height=1080 Or less common: mkvpropedit "%%I" --edit track:v1 --set display-width=16 --set display-height=9 --set display-unit=3 Be careful when working on files without a backup. What exactly has to be done depends highly on the source files - working with anamorphic files is not trivial. |
![]() |
![]() |
![]() |
#5 | Link |
Registered User
Join Date: Jan 2013
Posts: 10
|
Do you know where I can find a complete list of options for the command, because the source website doesn't list those.
|
![]() |
![]() |
![]() |
#7 | Link |
Registered User
Join Date: Jan 2013
Posts: 10
|
That's awesome, think I got it working!
Thanks ![]() One last thing: I've also been trying to write a batch file which would search folders recursively, merging subtitles (.srt files) with the video files of the same name. Would you know how to do that? |
![]() |
![]() |
![]() |
#9 | Link |
Registered User
Join Date: Jan 2013
Posts: 10
|
Actually I'm stuck on one snag.
Here is my batch file now: Code:
@echo on SET /P folder=Source folder: CD /D %folder% PAUSE FOR /R %%I IN (*.mkv) DO (mkvpropedit "%%~I" --edit track=v1 --set display-width=16 --set display-height=9 --set display-unit=3) A:\#Videos\Movies\#Comedy>(mkvpropedit "A:\#Videos\...\file.mkv" --edit track=v1 --set display-width=16 --set display-height=9 --set display-unit=3) Error: Invalid selector in '--edit track=v1'. |
![]() |
![]() |
![]() |
#14 | Link |
Registered User
Join Date: Jan 2013
Posts: 10
|
Aw too bad, because its weird - I have some files (even within the same season/folder) which are very noticeably louder or quieter than the others. I've tried the replay gain option with VLC but it didn't really make a difference..
|
![]() |
![]() |
![]() |
#16 | Link |
Registered User
Join Date: Jan 2013
Posts: 10
|
Hey sneaker, got another quick followup question for ya.
So here's my code: Code:
@echo off setlocal enabledelayedexpansion SET /P folder=Source folder: CD /D %folder% FOR /R %%I IN (*.avi) DO ( ECHO %%~fI IF EXIST "%%~fI" ( :if an avi file exists, convert it echo "%%~I" exists mkvmerge -o "%%~dI%%~pI%%~nI.mkv" "%%I" IF EXIST "%%~nI.mkv" ( :if mkv conversion successful, then delete source file RECYCLE "%%~fI" ECHO "%%~I DELETED" ) ) ) FOR /R %%I IN (*.mp4) DO ( ECHO %%~fI IF EXIST "%%~fI" ( :if an mp4 file exists, convert it echo "%%~I" exists mkvmerge -o "%%~dI%%~pI%%~nI.mkv" "%%I" IF EXIST "%%~nI.mkv" ( :if mkv conversion successful, then delete source file RECYCLE "%%~fI" ECHO "%%~I DELETED" ) ) ) pause FOR /R %%I IN (*.mkv) DO (mkvpropedit "%%~I" --edit track:v1 --set display-width=16 --set display-height=9 --set display-unit=3) Last edited by LanguidLegend; 18th February 2013 at 10:48. |
![]() |
![]() |
![]() |
Tags |
aspect ratio, batch, mkvmerge, mkvtoolnix, subfolders |
Thread Tools | Search this Thread |
Display Modes | |
|
|