Last active
October 21, 2023 06:58
-
-
Save HunterAP23/690e6c96c7a14da73b4499620987b18a to your computer and use it in GitHub Desktop.
Convert Media Sources to lossless ProRes MOV with transparency
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
@echo off | |
setlocal EnableDelayedExpansion | |
for %%a in (*.webm *.mkv) do ( | |
FOR /F "usebackq" %%F IN (`ffprobe -v error -select_streams v:0 -show_entries stream^=codec_name -of default^=noprint_wrappers^=1:nokey^=1 "%%a"`) DO ( | |
if "%%F"=="vp8" ( | |
ffmpeg -hide_banner -c:v libvpx -i "%%a" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 "%%~dpna_PRORES.mov" | |
) else ( | |
if "%%F"=="vp9" ( | |
ffmpeg -hide_banner -c:v libvpx-vp9 -i "%%a" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 "%%~dpna_PRORES.mov" | |
) else ( | |
ffmpeg -hide_banner -i "%%a" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 "%%~dpna_PRORES.mov" | |
) | |
) | |
) | |
) | |
for %%a in (*.mp4 *.mov *.avi) do ( | |
ffmpeg -hide_banner -i "%%a" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 "%%~dpna_PRORES.mov" | |
) |
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
$loc = $args[0] | |
If ($args.length -eq 0) { | |
"Defaulting to current directory of `"$(Get-Location)`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" | |
} ElseIf ( $(Try { Test-Path $args[0].trim() } Catch { $false }) ) { | |
"Path `"$loc`" was found." | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" | |
} Else { | |
"Path `"$loc`" was not found." | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" | |
exit | |
} | |
@(Get-ChildItem -Path $loc -File -Filter *.webm).foreach({ | |
"Working on file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" | |
$pat = Split-Path ($_).FullName | |
$codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$_" | |
$new = "$pat\$(($_).BaseName)_PRORES.mov" | |
If ($codec -eq "vp8") { | |
ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" | |
} ElseIF ($codec -eq "vp9") { | |
ffmpeg -hide_banner -hwaccel auto -c:v libvpx-vp9 -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" | |
} Else { | |
ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" | |
} | |
"Finished file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" | |
}) | |
@(Get-ChildItem -Path $loc -File -Filter *.mov).foreach({ | |
If ($_ -notmatch "_PRORES.mov") { | |
$codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$_" | |
If ($codec -eq "rawvideo") { | |
"File `"$_`" is already in prores MOV format - skipping..." | Out-File -append -noClobber -encoding UTF8 -filepath "$(Get-Location)\media_to_prores.log" | |
} Else { | |
"Working on file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" | |
$pat = Split-Path ($_).FullName | |
$new = "$pat\$(($_).BaseName)_PRORES.mov" | |
ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" | |
"Finished file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" | |
} | |
} | |
}) | |
@(Get-ChildItem -Path $loc -File -Filter *.mp4).foreach({ | |
"Working on file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" | |
$pat = Split-Path ($_).FullName | |
$new = "$pat\$(($_).BaseName)_PRORES.mov" | |
ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" | |
"Finished file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" | |
}) | |
@(Get-ChildItem -Path $loc -File -Filter *.mkv).foreach({ | |
"Working on file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" | |
$pat = Split-Path ($_).FullName | |
$codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$_" | |
$new = "$pat\$(($_).BaseName)_PRORES.mov" | |
If ($codec -eq "vp8") { | |
ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" | |
} ElseIF ($codec -eq "vp9") { | |
ffmpeg -hide_banner -hwaccel auto -c:v libvpx-vp9 -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" | |
} Else { | |
ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" | |
} | |
"Finished file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" | |
}) | |
@(Get-ChildItem -Path $loc -File -Filter *.avi).foreach({ | |
"Working on file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" | |
$pat = Split-Path ($_).FullName | |
$new = "$pat\$(($_).BaseName)_PRORES.mov" | |
ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -c:v prores_ks -pix_fmt yuva444p10le -profile:v 4444xq -quant_mat hq -c:a aac -q:a 5 -y "$new" | |
"Finished file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_prores.log" | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment