Skip to content

Instantly share code, notes, and snippets.

@jeffa00
Created March 6, 2016 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffa00/13c269b1bcf732755fb1 to your computer and use it in GitHub Desktop.
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.
<#
.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