2023-10-14 11:50:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# yt-dlp 依赖 ffmpeg
|
|
|
|
# https://github.com/yt-dlp/yt-dlp#dependencies
|
|
|
|
|
2023-10-15 02:58:53 +00:00
|
|
|
# 判断系统架构
|
2024-07-01 11:14:55 +00:00
|
|
|
arch=$(uname -m)
|
2023-10-15 02:58:53 +00:00
|
|
|
|
2024-07-01 11:47:31 +00:00
|
|
|
# 输出架构信息
|
|
|
|
echo "当前系统架构是:$arch"
|
2023-10-15 02:58:53 +00:00
|
|
|
|
2024-07-01 11:47:31 +00:00
|
|
|
install_from_build() {
|
|
|
|
pkg=$1
|
2024-07-01 11:14:55 +00:00
|
|
|
wget https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/$pkg.tar.xz
|
|
|
|
tar -xvJf $pkg.tar.xz
|
|
|
|
mv $pkg ffmpeg
|
2024-07-01 11:47:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
install_from_apt() {
|
2024-07-01 11:14:55 +00:00
|
|
|
apt-get update
|
|
|
|
apt-get install -y ffmpeg
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
mkdir -p /app/ffmpeg/bin
|
|
|
|
ln -s /usr/bin/ffmpeg /app/ffmpeg/bin/ffmpeg
|
|
|
|
ln -s /usr/bin/ffprobe /app/ffmpeg/bin/ffprobe
|
2024-07-01 11:47:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# 基于架构执行不同的操作
|
|
|
|
case "$arch" in
|
|
|
|
x86_64)
|
|
|
|
echo "64位 x86 架构"
|
|
|
|
pkg=ffmpeg-master-latest-linux64-gpl
|
2024-07-02 03:11:17 +00:00
|
|
|
#install_from_build "$pkg"
|
|
|
|
install_from_apt
|
2024-07-01 11:47:31 +00:00
|
|
|
;;
|
|
|
|
arm64 | aarch64)
|
|
|
|
echo "64位 ARM 架构"
|
|
|
|
pkg=ffmpeg-master-latest-linuxarm64-gpl
|
|
|
|
install_from_build "$pkg"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "未知架构 $arch"
|
|
|
|
install_from_apt
|
|
|
|
;;
|
|
|
|
esac
|