TroubleChute Logo
< Go Back

TroubleChute Script Hub

Currently viewing: PowerShell/Software/ffmpeg.ps1


NOTE: The following code may be out-of-date compared to GitHub, but is all pulled from GitHub every hour or so.

When shortlinks are used (filename as subdomain), code used by PowerShell and other interactions with this site is served from GitHub.

(Right-click -> Download the button below to save the file)

Last modified: 2023-06-29T15:00:53.000+02:00

ffmpeg.ps1
# Copyright (C) 2023 TroubleChute (Wesley Pyburn)
# Licensed under the GNU General Public License v3.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.gnu.org/licenses/gpl-3.0.en.html
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#    
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#    
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see .
#
# ----------------------------------------
# This script lets you install FFMPEG in an even faster, easier way.
# The installation is already super simple, but this is next-level.
# This script:
# 1. Install Chocolatey
# 2. Install FFMPEG
# ----------------------------------------

Write-Host "--------------------------------------------" -ForegroundColor Cyan
Write-Host "Welcome to TroubleChute's FFMPEG installer!" -ForegroundColor Cyan
Write-Host "Chocolatey [package manager] and FFMPEG will now be installed..." -ForegroundColor Cyan
Write-Host "[Version 2023-05-19]" -ForegroundColor Cyan
Write-Host "`nThis script is provided AS-IS without warranty of any kind. See https://tc.ht/privacy & https://tc.ht/terms."
Write-Host "Consider supporting these install scripts: https://tc.ht/support" -ForegroundColor Green
Write-Host "--------------------------------------------`n`n" -ForegroundColor Cyan

iex (irm Import-RemoteFunction.tc.ht) # Get RemoteFunction importer
Import-RemoteFunction("Get-GeneralFuncs.tc.ht")

# 1. Install Chocolatey
Write-Host "`nInstalling Chocolatey..." -ForegroundColor Cyan
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

# 2. Install FFMPEG using Chocolatey
Clear-ConsoleScreen
$wasntPreset = !($null -ne $ffmpegSelection)
if ($wasntPreset){
    # Ask user what to install, if not already defined.
    Write-Host "Which FFMPEG would you like to install?" -ForegroundColor Cyan
    Write-Host -NoNewline "- FFMPEG: " -ForegroundColor Red
    Write-Host "1" -ForegroundColor Green
    Write-Host -NoNewline "- FFMPEG-Shared: " -ForegroundColor Red
    Write-Host "2" -ForegroundColor Green
    Write-Host -NoNewline "- FFMPEG-Full [This has the most codecs]: " -ForegroundColor Red
    Write-Host "3" -ForegroundColor Green

    $ffmpegSelection = (Read-Host "Enter a number").Trim()
}

switch ($ffmpegSelection) {
    1 {
        Clear-ConsoleScreen
        Write-Host "Installing FFMPEG..." -ForegroundColor Cyan
        choco upgrade ffmpeg -y
        Write-Host "Done." -ForegroundColor Green
        break
    }
    2 {
        Clear-ConsoleScreen
        Write-Host "Installing FFMPEG-Shared..." -ForegroundColor Cyan
        choco upgrade ffmpeg-shared -y
        Write-Host "Done." -ForegroundColor Green
        break
    }
    3 {
        Clear-ConsoleScreen
        Write-Host "Installing FFMPEG-Full..." -ForegroundColor Cyan
        choco upgrade ffmpeg-full -y
        Write-Host "Done." -ForegroundColor Green
        break
    }
    default {
        Write-Host "Invalid selection. Please choose a valid option." -ForegroundColor Red
    }
}

# Show success, only if the FFMPEG installation wasn't automated.
$ffmpegSelection = $null
if ($wasntPreset){
    ffmpeg -version
    
    Write-Host "`nThe above was returned after running 'ffmpeg -version'" -ForegroundColor Green
    Write-Host "You should now be able to use 'ffmpeg' anywhere on your computer." -ForegroundColor Green
    Write-Host "To update in the future, run 'choco upgrade all -y'" -ForegroundColor Cyan
}

TCNO TechNobo / TroubleChute © Wesley Pyburn (TroubleChute)
Support Me Privacy Policy Cookies Policy Terms of Service Contact