Skip to content

Instantly share code, notes, and snippets.

@a-sync
Last active December 19, 2023 17:39
Show Gist options
  • Save a-sync/5b736611b73f98d966ad543b62f0e59b to your computer and use it in GitHub Desktop.
Save a-sync/5b736611b73f98d966ad543b62f0e59b to your computer and use it in GitHub Desktop.
Download the latest ffmpeg & ffprobe release from https://www.gyan.dev/ffmpeg/builds/ and replace the global binaries
@echo off
title update-ffmpeg.bat @ https://gist.github.com/a-sync
rem CONFIGURE BUILD: release-essentials / release-full / git-essentials / git-full
set BUILD=release-essentials
rem FIND FFMPEG
for /F "tokens=* USEBACKQ" %%F in (`where ffmpeg`) do (
set FFMPEGPATH=%%F
goto done1
)
:done1
rem FIND FFPROBE
for /F "tokens=* USEBACKQ" %%F in (`where ffprobe`) do (
set FFPROBEPATH=%%F
goto done2
)
:done2
rem FIND FFPLAY
for /F "tokens=* USEBACKQ" %%F in (`where ffplay`) do (
set FFPLAYPATH=%%F
goto done3
)
:done3
rem DOWNLOAD 7-ZIP
where /q 7za
if ERRORLEVEL 1 (
set SZAPATH=%TEMP%\7za.exe
if not exist %TEMP%\7za.exe (
echo Downloading 7-zip command line tool...
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://a-sync.github.io/7z-extra/7za.exe', '%TEMP%\7za.exe')"
)
) else (
set SZAPATH=7za
)
rem DOWNLOAD ARCHIVE
echo Downloading latest ffmpeg-%BUILD% package...
powershell -Command "$ProgressPreference='SilentlyContinue'; (New-Object Net.WebClient).DownloadFile('https://www.gyan.dev/ffmpeg/builds/ffmpeg-%BUILD%.7z', '%~dp0\ffmpeg.7z')"
rem UNPACK ARCHIVE
echo Unpacking files...
%SZAPATH% e -y -r ffmpeg.7z ffmpeg.exe ffprobe.exe ffplay.exe 1>nul
del ffmpeg.7z 2>nul
rem REPLACE FFMPEG
if defined FFMPEGPATH (
echo Replacing %FFMPEGPATH%
move /y ffmpeg.exe "%FFMPEGPATH%" 1>nul
) else (
del ffmpeg.exe
)
rem REPLACE FFPROBE
if defined FFPROBEPATH (
echo Replacing %FFPROBEPATH%
move /y ffprobe.exe "%FFPROBEPATH%" 1>nul
) else (
del ffprobe.exe
)
rem REPLACE FFPLAY
if defined FFPLAYPATH (
echo Replacing %FFPLAYPATH%
move /y ffplay.exe "%FFPLAYPATH%" 1>nul
) else (
del ffplay.exe
)
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment