jaseg / python-mpv

Python interface to the awesome mpv media player
https://git.jaseg.de/python-mpv.git
Other
531 stars 67 forks source link

Installing libmpv without GUI #234

Closed bennetrr closed 1 year ago

bennetrr commented 1 year ago

I want to use this library on my headless Raspberry Pi, which has no GUI (also I want to test the code on WSL).

When I install one of the following packages

apt install mpv libmpv-dev libmpv1

I get a huge list of packages:

The following NEW packages will be installed:
  adwaita-icon-theme alsa-topology-conf alsa-ucm-conf at-spi2-core dconf-gsettings-backend dconf-service ffmpeg fontconfig gsettings-desktop-schemas gtk-update-icon-cache hicolor-icon-theme humanity-icon-theme i965-va-driver intel-media-va-driver libaacs0 libaom3 libasound2 libasound2-data libass9 libasyncns0  
  libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0 libauthen-sasl-perl libavahi-client3 libavahi-common-data libavahi-common3 libavc1394-0 libavcodec58 libavdevice58 libavfilter7 libavformat58 libavutil56 libbdplus0 libblas3 libbluray2 libbs2b0 libcaca0 libcairo-gobject2 libcdio-cdda2
  libcdio-paranoia2 libcdio19 libchromaprint1 libclone-perl libcodec2-1.0 libcolord2 libcups2 libdata-dump-perl libdatrie1 libdav1d5 libdc1394-25 libdconf1 libdecor-0-0 libdecor-0-plugin-1-cairo libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdvdnav4 libdvdread8 libegl-mesa0 libegl1
  libencode-locale-perl libepoxy0 libfile-basedir-perl libfile-desktopentry-perl libfile-listing-perl libfile-mimeinfo-perl libflac8 libflite1 libfont-afm-perl libfontenc1 libgbm1 libgdk-pixbuf-2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgfortran5 libgl1 libgl1-amber-dri libgl1-mesa-dri
  libglapi-mesa libglvnd0 libglx-mesa0 libglx0 libgme0 libgraphite2-3 libgsm1 libgtk-3-0 libgtk-3-bin libgtk-3-common libgtkd-3-0 libharfbuzz0b libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl
  libhttp-message-perl libhttp-negotiate-perl libice6 libiec61883-0 libigdgmm12 libio-html-perl libio-socket-ssl-perl libio-stringy-perl libipc-system-simple-perl libjack-jackd2-0 liblapack3 liblilv-0-0 libllvm11 libllvm13 liblua5.2-0 liblwp-mediatypes-perl liblwp-protocol-https-perl libmailtools-perl libmfx1  
  libmp3lame0 libmpg123-0 libmpv-dev libmpv1 libmujs1 libmysofa1 libnet-dbus-perl libnet-http-perl libnet-smtp-ssl-perl libnet-ssleay-perl libnorm1 libogg0 libopenal-data libopenal1 libopenmpt0 libopus0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpciaccess0 libpgm-5.3-0 libphobos2-ldc-shared98      
  libplacebo192 libpocketsphinx3 libpostproc55 libpulse0 librabbitmq4 libraw1394-11 librsvg2-2 librsvg2-common librubberband2 libsamplerate0 libsdl2-2.0-0 libsensors-config libsensors5 libserd-0-0 libshine3 libsixel1 libsm6 libsnappy1v5 libsndfile1 libsndio7.0 libsord-0-0 libsoxr0 libspeex1 libsphinxbase3      
  libsratom-0-0 libsrt1.4-gnutls libssh-gcrypt-4 libswresample3 libswscale5 libthai-data libthai0 libtheora0 libtie-ixhash-perl libtimedate-perl libtry-tiny-perl libtwolame0 libudfread0 liburi-perl libva-drm2 libva-wayland2 libva-x11-2 libva2 libvdpau1 libvidstab1.1 libvorbis0a libvorbisenc2 libvorbisfile3     
  libvpx7 libvte-2.91-0 libvte-2.91-common libvted-3-0 libvulkan1 libwayland-client0 libwayland-cursor0 libwayland-egl1 libwayland-server0 libwebpmux3 libwww-perl libwww-robotrules-perl libx11-protocol-perl libx11-xcb1 libx264-163 libx265-199 libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0      
  libxcb-randr0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxft2 libxi6 libxinerama1 libxkbcommon0 libxkbfile1 libxml-parser-perl libxml-twig-perl libxml-xpathengine-perl libxmu6 libxrandr2 libxshmfence1 libxss1 libxt6 libxtst6 libxv1 libxvidcore4
  libxxf86dga1 libxxf86vm1 libzimg2 libzmq5 libzvbi-common libzvbi0 mesa-va-drivers mesa-vdpau-drivers mesa-vulkan-drivers mpv ocl-icd-libopencl1 perl-openssl-defaults pocketsphinx-en-us python3-pycryptodome python3-pyxattr rtmpdump session-migration tilix tilix-common ubuntu-mono va-driver-all
  vdpau-driver-all x11-common x11-utils x11-xserver-utils xdg-utils youtube-dl

APT wants to install graphic drivers and a XServer in my WSL.

Is there a way to install libmpv without a desktop environment?

jaseg commented 1 year ago

This is because of the way your distro has compiled libmpv for its libmpv1 package. We can't do anything about that from python-mpv, since we just use the libmpv.so that you provide. Still, here's three options that I can think of on what you could try:

  1. You install the distro package with all its dependencies. They won't do anything bad if you don't use them. In WSL you can have all of that stuff installed with no harm done, GUI functions just won't work.
  2. You can build your own libmpv from source where you can disable all those GUI features.
  3. If you're using libmpv for transcoding only and you're not using it for video or audio output, you may be served better by directly using ffmpeg (which mpv ultimately wraps).