public/Get-CTMediaProfile.ps1

<#
https://$($ip)/stw-cgi/media.cgi?msubmenu=videoprofile&action=update
EncodingType=H265
Resolution=$($resX)x$($resY)
FrameRate=$($framerate)
Bitrate=5120
H265.PriorityType=FrameRate
H265.GOVLength=8
H265.DynamicGOVLength=8
H265.EntropyCoding=CABAC
H265.Profile=Main
H265.BitrateControlType=VBR
H265.SmartCodecEnable=False
H265.DynamicFPSEnable=False
H265.MinDynamicFPS=1
Profile=1
Channel=$($channelnum)
#>


Function Get-CTMediaProfile {
    [cmdletBinding(
        DefaultParameterSetName='All',
        #SupportsShouldProcess = $true,
        ConfirmImpact='high'
        )]
    Param(
        [Parameter(
            Mandatory=$true,
            ParameterSetName='All'
        )]
        [String]$IP,

        [Parameter(
            Mandatory=$true,
            ParameterSetName='All'
        )]
        [pscredential]$Credential,

        [Parameter(
            Mandatory=$false,
            ParameterSetName='All'
        )]
        [String]$ProfileId,

        [Parameter(
            Mandatory=$false,
            ParameterSetName='All'
        )]
        [String]$Channel
    )
    DynamicParam {
        $DynamicParameters = @{
            CameraType = @{
                Mandatory = $true
                Position = 1
                ParameterSetName = "All"
                Enum = $Script:SupportedCameraModels
            }
        }

        return New-DynamicParameterSet -ParameterTable $DynamicParameters
    }
    Begin {
        Write-Debug "[Get-CTMediaProfile] Started"
        $CameraType = $PSBoundParameters.CameraType

        if($CameraType -eq 'Hanwha') {
            #Set basic Paramters for Invoke-HanwhaCommand
            $CamCmd = @{
                Arguments = @{
                    IP = $IP
                    Menu = 'media'
                    SubMenu = 'videoprofile'
                    Action = 'view'
                    Parameters = @()
                }
                Credential = $Credential
            }

            #Add Action Parameters
            if($Channel -and !$ProfileId) {
                $CamCmd.Arguments.Parameters += "Channel=$Channel"
            }
            elseif($ProfileId -and !$Channel) {
                $CamCmd.Arguments.Parameters += "Profile=$ProfileId"
            }
            else {
                $CamCmd.Arguments.Parameters += "Channel.$Channel.Profile=$ProfileId"
            }
            
            $output = (Invoke-HanwhaCommand @CamCmd).VideoProfiles

            if($ProfileId -and $Channel) {
                return $output.Profiles[0]
            }

            return $output
        }
    }
}