• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.
  • The forums have been upgraded with support for dark mode. By default it will follow the setting on your system/browser. You may override it by scrolling to the end of the page and clicking the gears icon.

Batch file needs tweaking

hat

Enthusiast
Joined
Nov 20, 2006
Messages
21,759 (3.20/day)
Location
Ohio
System Name Starlifter :: Dragonfly
Processor i7 2600k 4.4GHz :: i5 10400
Motherboard ASUS P8P67 Pro :: ASUS Prime H570-Plus
Cooling Cryorig M9 :: Stock
Memory 4x4GB DDR3 2133 :: 2x8GB DDR4 2400
Video Card(s) PNY GTX1070 :: Integrated UHD 630
Storage Crucial MX500 1TB, 2x1TB Seagate RAID 0 :: Mushkin Enhanced 60GB SSD, 3x4TB Seagate HDD RAID5
Display(s) Onn 165hz 1080p :: Acer 1080p
Case Antec SOHO 1030B :: Old White Full Tower
Audio Device(s) Creative X-Fi Titanium Fatal1ty Pro - Bose Companion 2 Series III :: None
Power Supply FSP Hydro GE 550w :: EVGA Supernova 550
Software Windows 10 Pro - Plex Server on Dragonfly
Benchmark Scores >9000
I've been using AviSynth for deinterlacing and tetelecining TV series lately, and in the process I have to write many scripts for each episode. I've found a batch file that pretty much automates this, but there is one issue. For example, if my source file is "Monk s01e01.mkv", the script the batch file gives me is named "Monk s01e01.mkv.avs". As the files AviSynth produces go by the name of the AVS script, if I processed the script with that name, the resulting file would be "Monk s01e01.mkv.avi". I need to get the .mkv part out of the .avs script the batch file produces. This is the batch file:

Code:
for %%n in (*.mkv*) do (
echo setmtmode(5,4^) > "%%n.avs"
echo ffmpegsource2("%%n"^) >> "%%n.avs"
echo setmtmode(2^) >> "%%n.avs"
echo qtgmc(edithreads=2^) >> "%%n.avs"
echo selecteven(^)  >> "%%n.avs"
)

So, any way to get the .mkv out of the files produced by this batch file? It really beats having to write a script for each episode individually.
 
For anyone interested, the folks at VideoHelp found a solution:

Code:
for %%a in (*.mkv) do (
echo setmtmode(5,4^) > "%%~na.avs"
echo ffmpegsource2("F:\AviSynth Worker\%%a"^) >> "%%~na.avs"
echo setmtmode(2^) >> "%%~na.avs"
echo qtgmc(edithreads=2^) >> "%%~na.avs"
echo selecteven(^)  >> "%%~na.avs"
)

This batch file will create a .avs script for every file ending in .mkv, the resulting filename(s) being the name of the .mkv file(s), with the .mkv extension dropped. For example, it sees "Red Dwarf s09e01.mkv", creates a file with the name of "Red Dwarf s09e01.avs" with the following code:

Code:
setmtmode(5,4) 
ffmpegsource2("F:\AviSynth Worker\Red Dwarf s09e01.mkv") 
setmtmode(2) 
qtgmc(edithreads=2) 
selecteven()

This is beyond useful for ripping interlaced DVDs en masse, should you want to deinterlace with AviSynth and QTGMC.
 
Back
Top