From 6f2b0ae9efdb16804e9e6ae45620baf97e6c7756 Mon Sep 17 00:00:00 2001 From: Lukas Reusser Date: Sun, 17 May 2020 14:15:10 +0200 Subject: [PATCH] Changed number of audio tracks from 2 to 6. Added check for string -HVEC in filename to make it run faster with lots of already converted files --- convert_Videos.ps1 | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/convert_Videos.ps1 b/convert_Videos.ps1 index 0f5e642..c9297f2 100644 --- a/convert_Videos.ps1 +++ b/convert_Videos.ps1 @@ -72,14 +72,20 @@ Write-Host "-------------------------------------------------------------------- foreach($video in $videos) { - - $video = $video.Replace("`"", "") - $inputFile = $videoPath + $video + # Check filename for '-HVEC' string and skip filetester if true to make it run faster with lots of files already converted + if(! $video -match "-HVEC") + { + $video = $video.Replace("`"", "") + $inputFile = $videoPath + $video + + # Get and check File info for codec, if it's already HEVC: - JSON query: (['media']['track'][1]['Format']) + $fileDetails = cmd /c $fileTester $inputFile --Output=JSON | ConvertFrom-Json + $codec = $fileDetails.media.track[1].Format + #echo $codec - # Get and check File info for codec, if it's already HEVC: - JSON query: (['media']['track'][1]['Format']) - $fileDetails = cmd /c $fileTester $inputFile --Output=JSON | ConvertFrom-Json - $codec = $fileDetails.media.track[1].Format - #echo $codec + } else {} + $codec = 'HVEC' + } # If not already HEVC, convert video using NVEncC64: if($codec -ne "HEVC") @@ -96,7 +102,7 @@ foreach($video in $videos) Write-Host # If the Subtitles should not be copied, delete the "--sub-copy 1,2" argument. - $arguments = "--input `"$inputFile`" --codec hevc --audio-copy 1,2 --sub-copy 1,2 --profile $profile --output `"$outputFile`"" + $arguments = "--input `"$inputFile`" --codec hevc --audio-copy 1,2,3,4,5,6 --sub-copy 1,2,3,4,5,6 --profile $profile --output `"$outputFile`"" Start-Process $NVEncoder -ArgumentList $arguments -WindowStyle Minimized