From 508b6f144671790c52c9a9736a50afb6de1fc15b Mon Sep 17 00:00:00 2001 From: Couleur <82747632+couleurm@users.noreply.github.com> Date: Fri, 4 Feb 2022 23:20:40 +0100 Subject: [PATCH] add ffmpeg test & set default enc args to libx264 --- install/post.ps1 | 26 +++++++++++++++++++++++++- settings/recipe.ini | 2 +- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/install/post.ps1 b/install/post.ps1 index 05ed1cf..8988170 100644 --- a/install/post.ps1 +++ b/install/post.ps1 @@ -26,4 +26,28 @@ Invoke-WebRequest -UseBasicParsing -Uri 'https://raw.githubusercontent.com/bjaan while (-not(Test-Path "$env:TMP\SVPFlow.7z")){$null} 7z x "$env:TMP\SVPFlow.7z" -o"$env:TMP\SVPFlow" Move-Item "$env:TEMP\svpflow\x64_vs\*.dll" "$DIR\vapoursynth64\plugins" -Force -Remove-Item "$env:TMP\SVPFlow.7z","$env:TMP\SVPFlow" -Force -Ea Ignore -Recurse \ No newline at end of file +Remove-Item "$env:TMP\SVPFlow.7z","$env:TMP\SVPFlow" -Force -Ea Ignore -Recurse + +Write-Warning "Testing FFmpeg encoders.." +@( + 'hevc_nvenc -rc constqp -preset p7 -qp 18' + 'h264_nvenc -rc constqp -preset p7 -qp 15' + 'hevc_amf -quality quality -qp_i 16 -qp_p 18 -qp_b 20' + 'h264_amf -quality quality -qp_i 12 -qp_p 12 -qp_b 12' + 'hevc_qsv -preset veryslow -global_quality:v 18' + 'h264_qsv -preset veryslow -global_quality:v 15' + 'libx265 -preset medium -crf 18' + 'libx264 -preset slow -crf 15' +) | ForEach-Object -Begin { + $script:shouldStop = $false +} -Process { + if ($shouldStop -eq $true) { return } + Invoke-Expression "ffmpeg.exe -loglevel fatal -f lavfi -i nullsrc=3840x2160 -t 0.1 -c:v $_ -f null NUL" + if ($LASTEXITCODE -eq 0){ + $script:valid_args = $_ + $shouldStop = $true # Crappy way to stop the loop since most people that'll execute this will technically be parsing the raw URL as a scriptblock + + } +} + +(Get-Content "$DIR\Smoothie\settings\recipe.ini") -replace ('-c:v libx264 -preset slow -crf 15',"-c:v $valid_args") | Set-Content "$DIR\Smoothie\settings\recipe.ini" \ No newline at end of file diff --git a/settings/recipe.ini b/settings/recipe.ini index abd3064..c9df4cf 100644 --- a/settings/recipe.ini +++ b/settings/recipe.ini @@ -16,7 +16,7 @@ intensity=1.27 [encoding] # How your video will be encoded process=ffmpeg -args=-c:v hevc_nvenc -preset p7 -rc constqp -qp 18 +args=-c:v libx264 -preset slow -crf 15 [misc] folder=