Skip to content

Instantly share code, notes, and snippets.

@prajaybasu
Last active December 3, 2019 15:34
Show Gist options
  • Save prajaybasu/883a0ff97850f3559a3fc48933ac58a5 to your computer and use it in GitHub Desktop.
Save prajaybasu/883a0ff97850f3559a3fc48933ac58a5 to your computer and use it in GitHub Desktop.
$inputFolderPath = $args[0]
Get-ChildItem $inputFolderPath -Filter *.mov |
Foreach-Object {
$inputFilePath = $_.FullName;
$outputWavPath = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($inputFilePath), [System.IO.Path]::GetFileNameWithoutExtension($inputFilePath) + ".wav")
$outputM4aPath = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($inputFilePath), [System.IO.Path]::GetFileNameWithoutExtension($inputFilePath) + ".m4a")
$outputMp4Path1 = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($inputFilePath), [System.IO.Path]::GetFileNameWithoutExtension($inputFilePath) + "1"+ ".mp4")
$outputMp4PathFinal = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($inputFilePath), [System.IO.Path]::GetFileNameWithoutExtension($inputFilePath) + ".mp4")
ffmpeg.exe -i $inputfilePath -vn -acodec copy $outputWavPath
qaac64.exe $outputWavPath -v 0 -q 2 -o $outputM4aPath
ffmpeg.exe -i $inputfilePath -vcodec libx265 -pix_fmt yuv420p -crf 18 -an $outputMp4Path1
ffmpeg.exe -i $outputMp4Path1 -i $outputM4aPath -acodec copy -vcodec copy $outputMp4PathFinal
Remove-Item $outputWavPath
Remove-Item $outputM4aPath
Remove-Item $outputMp4Path1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment