I have a problem with this part of a script:

"    # Scan the file with FFMPEG
    If ($global:LimitCPU) {
        ffmpeg.exe -v error -hwaccel qsv -hwaccel_device auto -i $fullName -max_muxing_queue_size 1024 -f null -threads $global:CPULimt - >$ffmpegLog 2>&1
    }
    Else {
        ffmpeg.exe -v error -hwaccel qsv -hwaccel_device auto -i $fullName -max_muxing_queue_size 1024 -f null - >$ffmpegLog 2>&1
    }"

It uses Intel QSV, so any H264 files that are video stream format "AVC" runs perfectly, but any H264 files that are video stream format "VC-1" gives errors, as Intel QSV do not fully support it. How can I change that part of the script so that if it detects it's "AVC" it runs with hardware transcoding ("-hwaccel qsv -hwaccel_device auto"), but if it detects that it's "VC-1" then it runs without hardware transcoding?

Here is an exempt from the script where this part is located:

"# Function to check a supplied video object with ffmpeg.exe
Function CheckFile {
    Param (
        [Object]$VideoFile,
        [switch]$AutoRepaired,
        [switch]$RescanVideo
    )

    # If the file is a new file being check, clear out the variables
    If (!($AutoRepaired)) {
        $global:RepairLength = $null
        $global:RepairedFile = $null
        $global:OrigLength = $null
        $global:OriginalFile = $null
    }

    # Reset the Deleted value
    $Deleted = $false

    # Get the full name of the Video Object with path included
    $fullName = $VideoFile.FullName

    # Get only the name of the video file
    $fileName = $VideoFile.Name

    # Counter for the number of files that have been scanned
    $global:VideoCount = $global:VideoCount + 1

    # Save the length and object of the video file to make sure the repaired video file length matches original
    If ($AutoRepaired) {
        $global:RepairLength = GetLength $VideoFile
        $global:RepairedFile = $VideoFile
    }
    Else {
        $global:OrigLength = GetLength $VideoFile
        $global:OriginalFile = $VideoFile
    }

    If ($RescanVideo) {
        Update-VideoArray -VideoFile $VideoFile -Status "Re-Scanning"
    } Else {
        Update-VideoArray -VideoFile $VideoFile -Status "Scanning"
    }
    
    LogWrite "Scanning File: $fullName" -Log
    Write-ScanOutput -Scanning

    If (Test-Path $ffmpegLog) {
        Try {
            Remove-Item -LiteralPath $ffmpegLog -Force
        } Catch {
            $ErrorMessage = $_.Exception.Message
            LogWrite "Error while removing old FFMPEG Log: $ErrorMessage" -Colour "Red"
            LogWrite "Scan cannot continue without the ability to modify: $ffmpegLog"
            Exit 1 
        }
    }

    # Scan the file with FFMPEG
    If ($global:LimitCPU) {
        ffmpeg.exe -v error -hwaccel qsv -hwaccel_device auto -i $fullName -max_muxing_queue_size 1024 -f null -threads $global:CPULimt - >$ffmpegLog 2>&1
    }
    Else {
        ffmpeg.exe -v error -hwaccel qsv -hwaccel_device auto -i $fullName -max_muxing_queue_size 1024 -f null - >$ffmpegLog 2>&1
    }

    # Check to see if the ffmpeg error log was empty
    If ($Null -eq (Get-Content $ffmpegLog)) {   
        # Get information to log to the CSV file
        $FileSize = "{0:N2}" -f (($VideoFile | Measure-Object -property length -sum ).sum / 1MB)
        $Date = $((Get-Date).ToString('yyyy-MM-dd'))"


These are script variables:
# Script Variables
[float]$ScriptVersion = 3.6
$fullName = ""
$fileName = ""
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
$scanHistory = Join-Path -path $scriptPath -childpath "ScanHistory.txt"
$Date = "$((Get-Date).ToString('yyyy-MM-dd'))"
$LogDir = Join-Path -path $scriptPath -childpath "log"
$LogPath = Join-Path -path $LogDir -childpath "log_$Date"
$ffmpegLog = Join-Path -path $LogPath -childpath "ffmpegerror.log"
$Logfile = Join-Path -path $LogPath -childpath "results.log"
$CSVfile = Join-Path -path $LogPath -childpath "results.csv"
$env:PATH = $env:PATH + ";."
$global:OrigLength = $null
$global:RepairLength = $null
$global:RepairedFile = $null
$global:OriginalFile = $null
$global:OriginalRemoved = $false
$global:CPULimt = 1
$global:VideoLibrary = "h264_qsv"

# Convert all Supplied Parameters to Global variables for use in all functions
$global:Path = $Path
$global:ConfigFile = $ConfigFile
$global:AutoRepair = $AutoRepair
$global:Rescan = $Rescan
$global:CRF = $CRF
$global:LimitCPU = $LimitCPU
$global:RemoveAll = $RemoveAll
$global:RemoveRepaired = $RemoveRepaired
$global:RemoveOriginal = $RemoveOriginal
$global:IAcceptResponsibility = $IAcceptResponsibility
$global:IdleScan = $IdleScan
$global:GPUEncoding = $GPUEncoding
$global:RepairVFileExtension = $Extension
$global:ContinuousScan = $ContinuousScan
$global:TrashEnabled = $TrashEnabled