添加安装ffmpeg脚本

This commit is contained in:
yulinling 2025-08-25 22:44:32 +08:00
parent 5527384183
commit 6504550915
2 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,31 @@
@echo off
chcp 65001 >nul
echo =====================================
echo Windows FFmpeg 自动安装脚本
echo =====================================
:: 设置下载地址gyan.dev 提供稳定构建)
set URL=https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip
set ZIP=ffmpeg.zip
set DEST=C:\ffmpeg
echo.
echo 下载 FFmpeg...
powershell -Command "Invoke-WebRequest -Uri %URL% -OutFile %ZIP%"
echo.
echo 解压到 %DEST% ...
powershell -Command "Expand-Archive -Path %ZIP% -DestinationPath %DEST% -Force"
echo.
echo 配置环境变量 PATH ...
setx /M PATH "%DEST%\bin;%PATH%"
echo.
echo 清理临时文件 ...
del %ZIP%
echo.
echo 安装完成,请重新打开命令提示符后输入: ffmpeg -version
pause

View File

@ -0,0 +1,39 @@
#!/bin/bash
set -e
echo "=============================="
echo " FFmpeg 跨平台安装脚本"
echo "=============================="
echo
OS=$(uname -s)
if [[ "$OS" == "Darwin" ]]; then
echo "检测到 macOS 系统"
if ! command -v brew &>/dev/null; then
echo "未检测到 Homebrew正在安装..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
echo "使用 Homebrew 安装 FFmpeg..."
brew install ffmpeg
elif [[ "$OS" == "Linux" ]]; then
echo "检测到 Linux 系统"
if command -v apt &>/dev/null; then
sudo apt update
sudo apt install -y ffmpeg
elif command -v dnf &>/dev/null; then
sudo dnf install -y ffmpeg
elif command -v pacman &>/dev/null; then
sudo pacman -S --noconfirm ffmpeg
else
echo "未检测到常见包管理器,请手动安装 FFmpeg。"
exit 1
fi
else
echo "暂不支持的系统: $OS"
exit 1
fi
echo
echo "安装完成,版本信息:"
ffmpeg -version | head -n 1