$loc = $args[0] If ($args.length -eq 0) { Write-Host "Defaulting to current directory of $(Get-Location)" } ElseIf ( $(Try { Test-Path $args[0].trim() } Catch { $false }) ) { Write-Host "Path $loc was found." } Else { Write-Host "Path $loc was not found." exit } @(Get-ChildItem -Path $loc -File -Filter *.webm).foreach({ Write-Host "Working on file $_" $pat = Split-Path ($_).FullName $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "($_).FullName" $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi" If ($codec -eq "vp8") { ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new" } ElseIf ($codec -eq "vp9") { ffmpeg -hide_banner -hwaccel auto -c:v libvpx-vp9 -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new" } Else { ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new" } }) @(Get-ChildItem -Path $loc -File -Filter *.mov).foreach({ Write-Host "Working on file $_" $pat = Split-Path ($_).FullName $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi" ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new" }) @(Get-ChildItem -Path $loc -File -Filter *.mp4).foreach({ Write-Host "Working on file $_" $pat = Split-Path ($_).FullName $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi" ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new" }) @(Get-ChildItem -Path $loc -File -Filter *.mkv).foreach({ Write-Host "Working on file $_" $pat = Split-Path ($_).FullName $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "($_).FullName" $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi" If ($codec -eq "vp8") { ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new" } ElseIf ($codec -eq "vp9") { ffmpeg -hide_banner -hwaccel auto -c:v libvpx-vp9 -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new" } Else { ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new" } }) @(Get-ChildItem -Path $loc -File -Filter *.avi).foreach({ If ($_ -notmatch "_RAWVIDEO.avi") { Write-Host "Working on file $_" $pat = Split-Path ($_).FullName $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi" ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new" } })