iso to mkv with powershell

Discussion of advanced MakeMKV functionality, expert mode, conversion profiles
Post Reply
stax76
Posts: 20
Joined: Fri Feb 05, 2010 7:20 pm

iso to mkv with powershell

Post by stax76 » Thu Jan 14, 2021 6:58 pm

Maybe somebody else finds it useful, a powershell script that converts iso to mkv:

Code: Select all

wt.exe -- powershell.exe -NoExit -NoLogo -File "D:\iso to mkv.ps1" source-file output-folder

Code: Select all

$MakeMkvCon64 = 'C:\Program Files (x86)\MakeMKV\makemkvcon64.exe'
$output = & $MakeMkvCon64 -r info "iso:$($args[0])"
$titles = $output -match 'TINFO:\d+,\d+,\d+,"\d+:\d+:\d+"'
$titles = $titles | foreach {
    $_ -match 'TINFO:(\d+),\d+,\d+,"(\d+):(\d+):(\d+)"' | Out-Null

    [PSCustomObject]@{
        Title    = $matches.1
        Duration = New-Object TimeSpan -ArgumentList $matches.2,$matches.3,$matches.4
    }
}

$titles = $titles | sort Duration -Descending

$longestTitle = $titles[0].Title
$outputFolder = $args[1]
$source = "iso:$($args[0])"

& $MakeMkvCon64 --progress=-stdout mkv $source $longestTitle $outputFolder

Post Reply