FFMpeg-Install.ps1


Description

Purpose

Install FFmpeg quickly on Windows devices that use the UserAdminModule toolkit.

Detailed Description

FFMpeg-Install validates that the current PowerShell session is running with administrative privileges before handing off to Chocolatey to install FFmpeg. The function ensures that installation is attempted only when elevated and relies on Chocolatey to deliver the latest FFmpeg package along with its required binaries.

Back to Top

Usage

Example 1

FFMpeg-Install

Run the function from an elevated PowerShell session to install FFmpeg via Chocolatey. The function exits with an error if elevation is missing so the installation never proceeds without administrator rights.

Back to Top

Notes

  • Requires Chocolatey to be available on the target machine.
  • Must be run from an elevated PowerShell session. Non-administrative sessions receive a clear error message and the install command does not run.
  • Installs the FFmpeg toolset so that additional media functions in the module can call ffmpeg and ffprobe.

Back to Top


Script

#Requires -PSEdition Core

<#
    .DESCRIPTION
        Installs FFMpeg using Chocolatey. Requires admin privileges.
#>
function FFMpeg-Install {
    # test if admin
    if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
        Write-Error "You must run this script as an administrator."

        return
    }

    choco install ffmpeg -y
}

Back to Top

Download

Please feel free to copy parts of the script or if you would like to download the entire script, simply click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.


Report Issues

You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.

Issue


Back to Top