Skip to content

Commit 62fc8a3

Browse files
authored
refactor and add AV1 support. (#16)
1 parent 4c32019 commit 62fc8a3

File tree

2 files changed

+21
-29
lines changed

2 files changed

+21
-29
lines changed

.github/workflows/blank2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
libavcodec-dev libswscale-dev python3-dev cython3 g++ nasm yasm git \
2323
libavfilter-dev libxmu-dev libxcb1-dev libdbus-1-dev libx11-dev \
2424
libxinerama-dev libxrandr-dev intltool libtool libwayland-dev libarchive-dev \
25-
wayland-protocols devscripts libass-dev libx264-dev libxss-dev \
25+
wayland-protocols devscripts libass-dev libx264-dev libxss-dev libdav1d-dev \
2626
libglib2.0-dev libpango1.0-dev binutils libxdg-basedir-dev libnotify-dev \
2727
libc++-dev libplacebo-dev libx265-dev ninja-build meson autotools-dev \
2828
autoconf automake make build-essential pkg-config desktop-file-utils zsync

mpv-AppImage.sh

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,61 +11,55 @@ export ARCH="$(uname -m)"
1111
export APPIMAGE_EXTRACT_AND_RUN=1
1212
REPO="https://github.com/mpv-player/mpv-build.git"
1313
URUNTIME="https://github.com/VHSgunzo/uruntime/releases/latest/download/uruntime-appimage-dwarfs-$ARCH"
14-
UPINFO="gh-releases-zsync|$GITHUB_REPOSITORY_OWNER|mpv-AppImage|latest|*$ARCH.AppImage.zsync"
14+
UPINFO="gh-releases-zsync|$(echo "$GITHUB_REPOSITORY" | tr '/' '|')|latest|*$ARCH.AppImage.zsync"
1515
LIB4BN="https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin"
16-
mkdir -p ./mpv/AppDir
17-
cd ./mpv/AppDir
1816

1917
# Build mpv
20-
CURRENTDIR="$(readlink -f "$(dirname "$0")")"
21-
git clone "$REPO" ./mpv-build
22-
cd ./mpv-build
23-
sed -i "s#meson setup build#meson setup build -Dprefix=$CURRENTDIR/shared#g" \
24-
./scripts/mpv-config
25-
./rebuild -j$(nproc)
26-
./install
27-
cd ..
18+
git clone "$REPO" ./mpv-build && (
19+
cd ./mpv-build
20+
printf "%s\n" "--enable-libdav1d" >> ffmpeg_options
21+
./rebuild -j$(nproc)
22+
sudo ./install
23+
)
2824
rm -rf ./mpv-build
29-
ln -s ./shared ./usr
3025

3126
# bundle libs
27+
mkdir -p ./AppDir
28+
cd ./AppDir
29+
3230
wget "$LIB4BN" -O ./lib4bin
3331
chmod +x ./lib4bin
34-
./lib4bin -p -w -v -s ./shared/bin/mpv
35-
VERSION=$(./bin/mpv --version 2>/dev/null | awk 'FNR==1 {print $2; exit}')
32+
./lib4bin -p -v -s -k "$(command -v mpv)"
33+
34+
VERSION=$(./bin/mpv --version | awk 'FNR==1 {print $2; exit}')
3635
if [ -z "$VERSION" ]; then
3736
echo "ERROR: Could not get version from mpv"
3837
exit 1
3938
fi
40-
export VERSION
4139
echo "$VERSION" > ~/version
40+
4241
# HACK
4342
sed -i 's|/usr|/KEK|g' ./shared/lib/ld-linux-x86-64.so.2
4443

4544
# prepare AppDir
46-
cp ./usr/share/applications/*.desktop ./
47-
cp ./usr/share/icons/hicolor/128x128/apps/mpv.png ./
45+
cp /usr/local/share/applications/mpv.desktop ./
46+
cp /usr/local/share/icons/hicolor/128x128/apps/mpv.png ./
4847
ln -s ./mpv.png ./.DirIcon
48+
4949
cat >> ./AppRun << 'EOF'
5050
#!/bin/sh
5151
CURRENTDIR="$(dirname "$(readlink -f "$0")")"
52-
export XDG_DATA_DIRS="$CURRENTDIR/usr/share:$XDG_DATA_DIRS"
53-
export PATH="$CURRENTDIR/bin:$PATH"
5452
CACHEDIR="${XDG_CACHE_HOME:-$HOME/.cache}"
5553
export PATH="$PATH:$CACHEDIR/mpv-appimage_yt-dlp"
56-
export XDG_DATA_DIRS="$CURRENTDIR/usr/share:$XDG_DATA_DIRS"
5754
5855
# Download yt-dlp if needed
5956
if echo "$@" | grep -q "http" && ! command -v yt-dlp >/dev/null 2>&1; then
6057
echo "Video link detected but yt-dlp is not installed, installing..."
6158
mkdir -p "$CACHEDIR"/mpv-appimage_yt-dlp
59+
YT="https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux"
6260
if command -v wget >/dev/null 2>&1; then
63-
YT="$(wget -q https://api.github.com/repos/yt-dlp/yt-dlp/releases -O - \
64-
| sed 's/[()",{} ]/\n/g' | grep -oi -m1 'https.*yt.*linux$')"
6561
wget -q "$YT" -O "$CACHEDIR"/mpv-appimage_yt-dlp/yt-dlp
6662
elif command -v curl >/dev/null 2>&1; then
67-
YT="$(curl -Ls https://api.github.com/repos/yt-dlp/yt-dlp/releases \
68-
| sed 's/[()",{} ]/\n/g' | grep -oi -m1 'https.*yt.*linux$')"
6963
curl -Ls "$YT" -o "$CACHEDIR"/mpv-appimage_yt-dlp/yt-dlp
7064
else
7165
echo "ERROR: You need wget or curl in order to download yt-dlp"
@@ -97,8 +91,9 @@ echo "Generating AppImage..."
9791
--header uruntime \
9892
-i ./AppDir -o ./mpv-"$VERSION"-anylinux-"$ARCH".AppImage
9993

100-
wget -qO ./pelf "https://github.com/xplshn/pelf/releases/latest/download/pelf_$ARCH"
94+
wget -qO ./pelf "https://github.com/xplshn/pelf/releases/latest/download/pelf_$ARCH"
10195
chmod +x ./pelf
96+
10297
echo "Generating [dwfs]AppBundle...(Go runtime)"
10398
./pelf --add-appdir ./AppDir \
10499
--appbundle-id="mpv-$VERSION" \
@@ -109,7 +104,4 @@ echo "Generating zsync file..."
109104
zsyncmake *.AppImage -u *.AppImage
110105
zsyncmake *.AppBundle -u *.AppBundle
111106

112-
mv ./*.AppImage* ../
113-
mv ./*.AppBundle* ../
114-
cd ..
115107
echo "All done!"

0 commit comments

Comments
 (0)