Created
April 10, 2023 15:08
-
-
Save AnjanaMadu/5f9689e9572492a50089f4a74b9b8de5 to your computer and use it in GitHub Desktop.
A powershell script to install ffmpeg in windows easily
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") | |
if (!$isAdmin) { | |
Write-Host "Please run this script as administrator." | |
exit | |
} | |
if (Get-Command ffmpeg -ErrorAction SilentlyContinue) { | |
Write-Host "ffmpeg is already installed." | |
exit | |
} | |
if (!(Get-Command 7z -ErrorAction SilentlyContinue)) { | |
Write-Host "7zip is not installed. Please install it first." | |
} | |
Write-Host "Downloading ffmpeg..." | |
Invoke-WebRequest -Uri "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.7z" -OutFile "ffmpeg.7z" | |
Write-Host "Extracting..." | |
7z x -y -o"C:\" "ffmpeg.7z" | |
$ffmpegFolder = Get-ChildItem -Path "C:\" -Filter "ffmpeg-*" -Directory | |
Rename-Item -Path $ffmpegFolder -NewName "ffmpeg" | |
Write-Host "Adding ffmpeg to PATH..." | |
$envPath = [Environment]::GetEnvironmentVariable("PATH", "Machine") | |
[Environment]::SetEnvironmentVariable("PATH", $envPath + ";C:\ffmpeg\bin", "Machine") | |
Write-Host "ffmpeg is installed. Following commands are available: ffmpeg, ffplay, ffprobe" |
Maxhem2
commented
Oct 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment