Created
October 3, 2012 17:09
-
-
Save gabbsmo/3828365 to your computer and use it in GitHub Desktop.
Hardsub mkv-files with HandbrakeCli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#COPYRIGHT: Gabriel Smoljár (2012) | |
#WEBSITE: http://twitter.com/gabbsmo | |
#DESCRIPTION: This PowerShell script process all mkv-files in a directory by | |
# burning the selected subtitle track into the video track. | |
# The video is then muxed together with the selected audio-track | |
# into a MP4-container. | |
# | |
#NOTES: HandbrakeCLI must be added to PATH for this script to work. | |
# Apply all parameters according to the HandbrakeCLI docs: https://trac.handbrake.fr/wiki/CLIGuide | |
#DEPENDENCIES: HanbrakeCLI, http://handbrake.fr | |
Param( | |
[parameter(Mandatory=$true)] | |
[alias("p")] | |
$Preset, | |
[parameter(Mandatory=$true)] | |
[alias("i")] | |
$InputDir, | |
[parameter(Mandatory=$true)] | |
[alias("o")] | |
$OutputDir, | |
[parameter(Mandatory=$true)] | |
[alias("w")] | |
$Width, | |
[parameter(Mandatory=$true)] | |
[alias("a")] | |
$Audio, | |
[parameter(Mandatory=$true)] | |
[alias("s")] | |
$Subtitle) | |
$items = Get-ChildItem -Path $InputDir | |
foreach ($item in $items) | |
{ | |
if ($items.Attributes -ne "Directory") | |
{ | |
$InputFile = $InputDir + "\" + $item.name | |
$OutputFile = $OutputDir + "\" $item.BaseName + ".m4v" | |
if ($item.Extension -ieq ".mkv") | |
{ | |
handbrakecli --preset $Preset --input $InputFile --output $OutputFile --audio $Audio --width $width --loose-anamorphic --subtitle $Subtitle --subtitle-burned "1" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment