-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make anylinux appimage be able to work with yt-dlp #2
Comments
Tried using that, it created a yt-dlp binary with a
Same error as before. Seems like the issue is in the mpv binary that for some reason gets broken when deploy everything is used. Related: probonopd/go-appimage#298 I noticed that the error has changed, before it used to say |
Why not use a mostly-static yt-dlp? $ file yt-dlp
yt-dlp: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=cc74c4a74145b7afe126ee5e67d528f4a0e6fee2, stripped Most static binaries on Linux will rely on libc of your system to do DNS resolutions & such, so if you remove even libc (as can happen from non standard static binaries like appimages), you would have to ensure to link against something like c-ares. |
I didn't know you had a static yt-dlp as well 👀 will test it tomorrow. And yes I am using the mpv-build scripts. I also have a refactored appimage script here since the original I wrote is a mess right now (was back when I was using linuxdeploy), the listed dependencies on the script are the name of the alpine packages. |
I didn't know either, seems like we indeed have an yt-dlp build in the repos. I'm glad. |
So after about 4 hrs wrestling with that build script, I gave up. Eventually, I redid the same experiment on alpine, and guess what, it compiled successfully with as much features enabled as possible (I only had to disable pulseaudio). Unfortunately now the issue was, no matter what I did, the binary always compiled dynamically. I learned years worth of meson in one day just to get it to work, disabling/enabling features one by one. That seems to be the end of my patience. |
If the binary isn't linked to anything but the libc/ld, then you should be happy that you got to that point, because you can know use appimagetool to create a small |
If you REALLY want a static binary (the rootfs is a git repo, it gets rebuilt every a few months, LTS): https://github.com/oasislinux/root-x86_64/blob/media/bin/mpv |
Sorry but I forgot to mention that on alpine I had to Also note that mpv build makes a mostly static binary, but it isn't fully static.
The workflow run on ubuntu 20.04: Note that on ubuntu the dependency list is different: https://github.com/Samueru-sama/mpv-AppImage/blob/main/.github/workflows/blank2.yml#L19-L25 And I had to install meson with pip3 You can also get the full raw log by clicking in the gear icon. And the appimage is already in the releases, it is the one that contains Do you want the raw binary from ubutu or alpine?
In the refactored build script I shared above I have listed the alpine dependencies, all you have to do is install them, do the |
That yt-dlp binary doesn't work with the regular MPV appimage that I have: But before, some needed context, there are two types of appimages:
With that said, the regular non anylinux appimage that I have does not have problems playing videos with yt-dlp. https://imgur.com/esDTLdS.png However trying that appimage with the static yt-dlp binary shows the following error:
First I play a video using my distros yt-dlp, no problems. I install yt-dlp with dbin. Now I get the error of above. I tested removing the yt-dlp from the distro just in case there is a conflict and I still get the same error. |
I see. I am not a regular linux user, I am a sysadmin/netadmin, so I only have experience with servers which are headless and static binaries are what work reliably on those. For now, I think AppImages are entirely out of the question. I might continue a longer rant at: Azathothas/Toolpacks#28 and also take @xplshn's pelf a bit more seriously. I had rather not spam here about topics completely unrelated to your Issue, and such will no longer reply. |
You can still run appimages without fuse by passing the The downside of this method is higher startup times and that the appimage remains extracted in /tmp after being closed. Ivan calls his appimages archimages, he basically wraps a junest enviroment into an appimage, something similar is also being done with conty containers, which for stuff like Steam which needs 32 bit libraries is the quick and dirty simple solution lol So appimages are very similar to staticx because I remember that when I had those errors with xdotool I was getting the error from a path in
The appimage runtime also does stuff like if you place a directory next to the appimage with the name of the appimage +
Doesn't seem like that was the issue, because you can run the appimage extracted as seen here: (You normally don't have to cd into the dir in /tmp and run the AppRun, I did it just to show that it is not a read-only filesystem) EDIT: Yeah I tested on the regular mpv arch package and the same error happens:
With that said the official binary does work with the mpv-appimage and mpv arch package. |
I tested it with a youtube vid, doesn't work either LOL. I first test with the regular mpv appimage that doesn't have everything deployed, it works, also note that I'm using the official yt-dlp binary. Then I try the same with the static mpv binary you linked, doesn't work. Edit: And it is just not yt-dlp, that mpv binary doesn't work with any video I give. |
Staticx, as you said, will decompress the entire archive, which is in fact the same thing that AppBundles do. AppImages' advantage is that they don't have slower start-up times than a regular binary, nor does it waste RAM. Also, static AppImages are a thing, an AppImage that is static on the outside, just like staticx binaries, but contains dynamically linked binaries within. Those type of AppImages is what we're hoping to get on your repo, basically staticx but for more broader use-cases. The issues you'll have with it are the same ones you'd have with staticx, appbundles and other ways of trying to create a portable binary, parting from an unportable one. |
No, it won't. Oasis is not FHS, that |
I have successfully compiled a static mpv appimage that is universal, is bundled with as many features as possible, and also contains youtube-dl and other goodies. I tested these on containers with only the bare minimums (not even yt dlp or any other utilities or libraries): !#doesn't even open
/tmp/.mount_mpv_MeElcnIj/usr/bin/mpv: error while loading shared libraries: libEGL.so.1: cannot open shared object file: No such file or directory !#VERSION
🌀 ❯ ./WIP-mpv_Media_Player-v0.38.0-741-ga0ebfc3462-anylinux-x86_64.AppImage -v
[cplayer] Command line options: '-v'
[cplayer] mpv v0.38.0-741-ga0ebfc3462 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
[cplayer] built on Sep 3 2024 19:57:30
[cplayer] libplacebo version: v7.349.0 (v7.349.0-9-gefb89342)
[cplayer] FFmpeg version: N-116848-g3f9b78bd19
[cplayer] FFmpeg library versions:
[cplayer] libavcodec 61.11.100
[cplayer] libavdevice 61.2.100
[cplayer] libavfilter 10.2.102
[cplayer] libavformat 61.5.101
[cplayer] libavutil 59.35.100
[cplayer] libswresample 5.2.100
[cplayer] libswscale 8.2.100
[cplayer] Configuration: -Dprefix=/home/runner/work/mpv-AppImage/mpv-AppImage/mpv/mpv.AppDir/usr -Dbuildtype=release
[cplayer] List of enabled features: build-date cplugins dvbin egl egl-x11 ffmpeg gl glibc-thread-name glob glob-posix gpl iconv jpeg lcms2 libass libavdevice libdl libplacebo linux-fstatfs lua52 memrchr posix ppoll pthread-condattr-setclock pulse vector vk-khr-display vt.h vulkan x11 zlib
[cplayer] Setting option 'v' = '' (flags = 8)
[cplayer] Usage: mpv [options] [url|path/]filename
[cplayer]
[cplayer] Basic options:
[cplayer] --start=<time> seek to given (percent, seconds, or hh:mm:ss) position
[cplayer] --no-audio do not play sound
[cplayer] --no-video do not play video
[cplayer] --fs fullscreen playback
[cplayer] --sub-file=<file> specify subtitle file to use
[cplayer] --playlist=<file> specify playlist file
[cplayer]
[cplayer] --list-options list all mpv options
[cplayer] --h=<string> print options which contain the given string in their name
[cplayer] Set property: user-data/osc/visibility="auto" -> 1
[cplayer] Set property: user-data/osc/margins={"b":0,"r":0,"t":0,"l":0} -> 1
libswscale 8.2.100
!#PLAYTEST (no yt-dlp)
❯ ./WIP-mpv_Media_Player-v0.38.0-741-ga0ebfc3462-anylinux-x86_64.AppImage 'https://iv.nowhere.moe/watch?v=HsQ-cr-AZsg'
[ffmpeg] tcp: Failed to resolve hostname iv.nowhere.moe: System error
Failed to open https://iv.nowhere.moe/watch?v=HsQ-cr-AZsg.
[ytdl_hook] Subprocess failed: init
[ytdl_hook] Subprocess failed: init
[ytdl_hook] Subprocess failed: init
[ytdl_hook]
[ytdl_hook] youtube-dl failed: not found or not enough permissions
Exiting... (Errors when loading file)
!#PLAYTEST (static/dynamic yt-dlp)
[ytdl_hook]
[ytdl_hook] youtube-dl failed: not found or not enough permissions
Failed to recognize file format.
#though I made sure it existed and had enough perms !#VERSION
🌀 ❯ ./MPV-Media-Player_0.38.0-6-archimage3.4.4-2-x86_64.AppImage -v
[cplayer] Command line options: '-v'
[cplayer] mpv v0.38.0-dirty Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
[cplayer] built on Jul 3 2024 05:59:22
[cplayer] libplacebo version: v7.349.0
[cplayer] FFmpeg version: n7.0.2
[cplayer] FFmpeg library versions:
[cplayer] libavutil 59.8.100
[cplayer] libavcodec 61.3.100
[cplayer] libavformat 61.1.100
[cplayer] libswscale 8.1.100
[cplayer] libavfilter 10.1.100
[cplayer] libswresample 5.1.100
[cplayer]
[cplayer] Configuration: -Db_pie=true -Dpython.bytecompile=1 -Dlibmpv=true -Dgl-x11=enabled -Dcaca=disabled -Dcdda=enabled -Ddvbin=enabled -Ddvdnav=enabled -Dlibarchive=enabled -Dopenal=enabled -Dprefix=/usr -Dlibexecdir=lib -Dsbindir=bin -Dauto_features=auto -Dbuildtype=plain -Dwrap_mode=nodownload
[cplayer] List of enabled features: alsa av-channel-layout avif-muxer build-date cdda cplugins cuda-hwaccel cuda-interop dmabuf-interop-gl dmabuf-wayland drm dvbin dvdnav egl egl-drm egl-wayland egl-x11 ffmpeg ffnvcodec gbm gl gl-x11 glibc-thread-name glob glob-posix gpl iconv jack javascript jpeg jpegxl lavu-uuid lcms2 libarchive libass libavdevice libbluray libdl libplacebo linux-fstatfs luajit memfd-create openal pipewire posix posix-shm ppoll pthread-condattr-setclock pulse rubberband rubberband-3 sixel uchardet vaapi vaapi-drm vaapi-wayland vaapi-x11 vapoursynth vdpau vdpau-gl-x11 vector vk-khr-display vt.h vulkan vulkan-interop wayland wayland-protocols-1-27 wayland-protocols-1-31 wayland-protocols-1-32 x11 xv zimg zimg-st428 zlib
[cplayer] Reading config file /etc/mpv/encoding-profiles.conf
[ifo_dvdnav] Opening /etc/mpv/encoding-profiles.conf
[bdmv/bluray] Opening /etc/mpv/encoding-profiles.conf
[file] Opening /etc/mpv/encoding-profiles.conf
[cplayer] Applying profile 'default'...
[cplayer] Setting option 'v' = '' (flags = 8)
[cplayer]
[cplayer] Usage: mpv [options] [url|path/]filename
[cplayer]
[cplayer] Basic options:
[cplayer] --start=<time> seek to given (percent, seconds, or hh:mm:ss) position
[cplayer] --no-audio do not play sound
[cplayer] --no-video do not play video
[cplayer] --fs fullscreen playback
[cplayer] --sub-file=<file> specify subtitle file to use
[cplayer] --playlist=<file> specify playlist file
[cplayer]
[cplayer] --list-options list all mpv options
[cplayer] --h=<string> print options which contain the given string in their name
[cplayer]
[cplayer] Set property: user-data/osc/visibility="auto" -> 1
[cplayer] Set property: user-data/osc/margins={"b":0,"r":0,"l":0,"t":0} -> 1
/tmp/.mount_MPV-MeMnlMOj/.local/share/junest/bin/junest: exit trap: line 1: syntax error near unexpected token `('
!#PLAYTEST (no yt-dlp)
❯ ./MPV-Media-Player_0.38.0-6-archimage3.4.4-2-x86_64.AppImage 'https://iv.nowhere.moe/watch?v=HsQ-cr-AZsg'
[ytdl_hook]
[ytdl_hook] youtube-dl failed: not found or not enough permissions
Failed to recognize file format.
Exiting... (Errors when loading file)
/tmp/.mount_MPV-MecDHbIL/.local/share/junest/lib/core/common.sh: exit trap: line 1: syntax error near unexpected token `('
!#PLAYTEST (static/dynamic yt-dlp)
[ffmpeg] tcp: Failed to resolve hostname iv.nowhere.moe: System error And finally mine: !#VERSION
./mpv.AppImage -v
[cplayer] Command line options: '-v'
[cplayer] mpv 0.38.0 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
[cplayer] built on Jan 1 1980 00:00:00
[cplayer] libplacebo version: v7.349.0
[cplayer] FFmpeg version: 6.1.2
[cplayer] FFmpeg library versions:
[cplayer] libavutil 58.29.100
[cplayer] libavcodec 60.31.102
[cplayer] libavformat 60.16.100
[cplayer] libswscale 7.5.100
[cplayer] libavfilter 9.12.100
[cplayer] libswresample 4.12.100
[cplayer]
[cplayer] Configuration: <ommited>
[cplayer] List of enabled features: alsa av-channel-layout avif-muxer build-date caca cplugins cuda-hwaccel cuda-interop dmabuf-interop-gl dmabuf-wayland drm dvbin dvdnav egl egl-drm egl-wayland egl-x11 ffmpeg ffnvcodec gbm gl glibc-thread-name glob glob-posix gpl iconv javascript jpeg jpegxl lavu-uuid lcms2 libarchive libass libavdevice libbluray libdl libplacebo linux-fstatfs lua memfd-create openal pipewire posix posix-shm ppoll pthread-condattr-setclock pulse rubberband rubberband-3 sdl2 sdl2-audio sdl2-gamepad sdl2-video uchardet vaapi vaapi-drm vaapi-wayland vaapi-x11 vdpau vector vk-khr-display vt.h vulkan vulkan-interop wayland wayland-protocols-1-27 wayland-protocols-1-31 wayland-protocols-1-32 x11 xv zimg zimg-st428 zlib
[cplayer] Reading config file /nix/store/rk6mmbi0838fg06dzkngc8ml1anplqbq-mpv-0.38.0/etc/mpv/encoding-profiles.conf
[ifo_dvdnav] Opening /nix/store/rk6mmbi0838fg06dzkngc8ml1anplqbq-mpv-0.38.0/etc/mpv/encoding-profiles.conf
[bdmv/bluray] Opening /nix/store/rk6mmbi0838fg06dzkngc8ml1anplqbq-mpv-0.38.0/etc/mpv/encoding-profiles.conf
[file] Opening /nix/store/rk6mmbi0838fg06dzkngc8ml1anplqbq-mpv-0.38.0/etc/mpv/encoding-profiles.conf
[cplayer] Applying profile 'default'...
[cplayer] Setting option 'v' = '' (flags = 8)
[cplayer]
[cplayer] Usage: mpv [options] [url|path/]filename
[cplayer]
[cplayer] Basic options:
[cplayer] --start=<time> seek to given (percent, seconds, or hh:mm:ss) position
[cplayer] --no-audio do not play sound
[cplayer] --no-video do not play video
[cplayer] --fs fullscreen playback
[cplayer] --sub-file=<file> specify subtitle file to use
[cplayer] --playlist=<file> specify playlist file
[cplayer]
[cplayer] --list-options list all mpv options
[cplayer] --h=<string> print options which contain the given string in their name
[cplayer]
[cplayer] Set property: user-data/osc/visibility="auto" -> 1
[cplayer] Set property: user-data/osc/margins={"r":0,"b":0,"l":0,"t":0} -> 1
!#PLAYTEST (no yt-dlp) |
What a shame, I tried
You just made a distro 😅 There has to be another way to fix the yt-dlp issues other than shipping an entire distro. Note that yt-dlp is an optional dependency of mpv, so it isn't bundled the appimage, but if the only way to fix this issue involves bundling yt-dlp I have no problem then, however this went a bit to extreme lol. |
Ofc it won't, libEGL.so provides graphics in Linux, (mesa-egl/mesa-libegl). Graphics are loaded when they are available, so |
@Azathothas Nix has a Musl store. Try to use that one for generating binaries if possible, it is extensive, so there shouldn't be issues, using Musl means 30% smaller binaries. |
@Azathothas I extracted your |
I tested @Samueru-sama's appimage in Void Glibc, and I have just tested on Alpine. It worked in both. |
@Azathothas Have you thought of using this: https://github.com/leleliu008/ppkg-formula-repository-official-core ? @Samueru-sama suggested it, I know you've used ppkg before, and I think that's what's used for providing various binaries already. |
Worth mentioning that I tried to use https://github.com/leleliu008/ppkg-formula-repository-official-core to build mpv but the build failed, I don't know if it is that I don't how to use it lol. |
All of the examples and tests was not to bash existing mpv appimages, rather it was to show that a fully portable (as is the entire point of appimages) image is possible but at the cost of size. So I am faced with a choice, reduce the size but at these costs:
Or I have a bloated appimage:
This doesn't mean I won't explore ways to minimize the size, but if I ever do end up supporting GUI apps, I will go for the bloated appimage route Also, I am in no control of what gets generated/included, it's essentially the /nix root packed as squash archive. I also had quite a bit of laugh reading this: boredsquirrel/dont-use-appimages#1 |
This one is built on a void-rootfs, has yt-dlp included, and also the void pkg manager It took the author roughly 5 hours of setting up the environment, figuring out dependencies and then finally building it. And my way: !#Replace mpv with any of the ~ 100000 nix pkg (https://search.nixos.org/packages ) and it just works
nix bundle --bundler "github:ralismark/nix-appimage" "nixpkgs#mpv" --log-format bar-with-logs
!# I just built an appimage of the ladybird browser and I simply replace mpv with ladybird.
# To my knowledge there's no official appimage for ladybird and the one created by the inventor himself, hasn't been updated https://github.com/probonopd/Ladybird.AppImage/issues/2
# If you know something else that's this easy & portable sure I am all ears And https://github.com/leleliu008/ppkg-formula-repository-official-core/blob/master/formula/mpv.yml is marked as type |
Be very careful asking other people about suggestions when making an appimage unless they actually know how they work, because the information you will get will very likely be very outdated.
That's because most appimages are the regular appimages I was talking about before that try to be mostly compatible, those that depend on Glibc and some host libraries. Those appimages are common because they are easy to make and rarely you need to change the build process to accommodate them and they cover +95% of linux users, I mean you can already see here my regular mpv appimage has been working fine since day one while the one that bundles everything has this weird issue with yt-dlp. The reason you don't see appimages like the mpv-anylinux one that work on all systems is the same reason you don't see static binaries of complex applications, it is not easy 😭 Also what do you mean by they don't include plugins? the qt plugins? those are included by the appimagetooling already. And at least for me (I don't know @xplshn lol) it isn't a very big deal if I never figure out how to get the anylinux appimage to work with yt-dlp, what gets me is that the issue seems simple but we don't know what is going wrong, sound works, video playback works, but for some reason it has that issue with yt-dlp.
Cringe warning: That very post motivated me to start contributing to appimages btw, you can see my github activity has been constant after I made that issue. (that and having ptsd from the yuzu flatpak shipping an oudated mesa lol).
Yeah for other applications (like Steam which the current appimage we have is 640 MiB) using this or the nix approach might produce a smaller appimage and be feasible, specially because with stuff like Steam you really want to be on a recent mesa version, which the distro you are using may not always have.
@leleliu008 here is a TL:DR since this is getting very long: I have two appimages being released here:
We don't know what breaks exactly, and it is the only thing that breaks because video playback and audio work perfectly on local videos. The bigger appimage bundles more system libraries (making it compatible on musl systems), you can inspect the contents of the appimages by passing the EDIT: I may have misread what @Azathothas said about insight and that only related to the mpv formula, but anyway any insight in this very issue is also appreciated. |
The issue has been fixed! Max found what the problem was 👀 Turns out go-appimage is breaking something in ld-linux.so. |
Have you tried to do the following:
-f
option to generate a single fileyt-dlp
binaryyt-dlp
single-file binary to the appimage (no need to use staticx since the appimage contains both ld.so and libc.so)Originally posted by @xplshn in Azathothas/Toolpacks#28 (comment)
The text was updated successfully, but these errors were encountered: