Created
March 6, 2016 00:13
-
-
Save jeffa00/13c269b1bcf732755fb1 to your computer and use it in GitHub Desktop.
Powershell module for converting flv files to mp4. I use it for the output of OpenBroadcaster.
This file contains hidden or 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
<# | |
.Synopsis | |
Converts a video from flv to mp4. | |
.Description | |
Calls ffmpeg to convert a video from flv to mp4. | |
.Parameter InputFile | |
Name of the flv file to convert. | |
.Parameter OutputFile | |
Name of the mp4 file. Defaults to the InputFile. | |
.Example | |
# Convert a file | |
Convert-Video -InputFile "myInputFile.flv" -OutputFile "myOutputFile.mp4" | |
#> | |
function Convert-Video { | |
param( | |
[string] $inputFile, | |
[string] $outputFile = $inputFile | |
) | |
if(!$inputFile.ToUpper().EndsWith(".FLV")) | |
{ | |
$inputFile = $inputFile + ".flv" | |
} | |
$inputFile | |
if($outputFile.ToUpper().EndsWith(".FLV")) | |
{ | |
$outputFile = $outputFile.Substring(0, $outputFile.ToUpper().IndexOf(".FLV")) | |
} | |
if(!$outputFile.ToUpper().EndsWith(".MP4")) | |
{ | |
$outputFile = $outputFile + ".mp4" | |
} | |
$outputFile | |
& ffmpeg -i $inputFile -c copy -copyts $outputFile | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment