UxPlay 1.73: AirPlay-Mirror and AirPlay-Audio server for Linux, macOS, and Unix (also runs on Windows).

Now developed at the GitHub site https://github.com/FDH2/UxPlay (where ALL user issues should be posted, and latest versions can be found).

Highlights:

Note: AirPlay2 multi-room audio streaming is not supported: use shairport-sync for that.

Packaging status (Linux and *BSD distributions)

Current Packaging status.

After installation:

Detailed description of UxPlay

This project is a GPLv3 open source unix AirPlay2 Mirror server for Linux, macOS, and *BSD. It was initially developed by antimof using code from OpenMAX-based RPiPlay, which in turn derives from AirplayServer, shairplay, and playfair. (The antimof site is no longer involved in development, but periodically posts updates pulled from the new main UxPlay site).

UxPlay is tested on a number of systems, including (among others) Debian (10 “Buster”, 11 “Bullseye”, 12 “Bookworm”), Ubuntu (20.04 LTS, 22.04 LTS, 23.04 (also Ubuntu derivatives Linux Mint, Pop!_OS), Red Hat and clones (Fedora 38, Rocky Linux 9.2), openSUSE Leap 15.5, Mageia 9, OpenMandriva “ROME”, PCLinuxOS, Arch Linux, Manjaro, and should run on any Linux system. Also tested on macOS Catalina and Ventura (Intel) and Sonoma (M2), FreeBSD 14.0, Windows 10 and 11 (64 bit).

On Raspberry Pi 4 model B, it is tested on Raspberry Pi OS (Bullseye and Bookworm) (32- and 64-bit), Ubuntu 22.04 LTS and 23.04, Manjaro RPi4 23.02, and (without hardware video decoding) on openSUSE 15.5. Also tested on Raspberry Pi Zero 2 W, 3 model B+, and now 5.

Its main use is to act like an AppleTV for screen-mirroring (with audio) of iOS/iPadOS/macOS clients (iPhone, iPod Touch, iPad, Mac computers) on the server display of a host running Linux, macOS, or other unix (and now also Microsoft Windows). UxPlay supports Apple’s AirPlay2 protocol using “Legacy Protocol”, but some features are missing. (Details of what is publicly known about Apple’s AirPlay 2 protocol can be found here, here and here; see also pyatv which could be a resource for adding modern protocols.) While there is no guarantee that future iOS releases will keep supporting “Legacy Protocol”, iOS 17 continues support.

The UxPlay server and its client must be on the same local area network, on which a Bonjour/Zeroconf mDNS/DNS-SD server is also running (only DNS-SD “Service Discovery” service is strictly necessary, it is not necessary that the local network also be of the “.local” mDNS-based type). On Linux and BSD Unix servers, this is usually provided by Avahi, through the avahi-daemon service, and is included in most Linux distributions (this service can also be provided by macOS, iOS or Windows servers). There is now an alternative Service discovery method, using a Bluetooth LE “beacon” See below for instructions.

Connections to the UxPlay server by iOS/MacOS clients can be initiated both in AirPlay Mirror mode (which streams lossily-compressed AAC audio while mirroring the client screen, or in the alternative AirPlay Audio mode which streams Apple Lossless (ALAC) audio without screen mirroring. In Audio mode, metadata is displayed in the uxplay terminal; if UxPlay option -ca <name> is used, the accompanying cover art is also output to a periodically-updated file <name>, and can be viewed with a (reloading) graphics viewer of your choice. Switching between Mirror and Audio modes during an active connection is possible: in Mirror mode, stop mirroring (or close the mirror window) and start an Audio mode connection, switch back by initiating a Mirror mode connection; cover-art display stops/restarts as you leave/re-enter Audio mode.

Possibility for using hardware-accelerated h264/h265 video-decoding, if available.

UxPlay uses GStreamer “plugins” for rendering audio and video. This means that video and audio are supported “out of the box”, using a choice of plugins. AirPlay streams video in h264 format: gstreamer decoding is plugin agnostic, and uses accelerated GPU hardware h264 decoders if available; if not, software decoding is used.

Note to packagers:

UxPlay’s GPLv3 license does not have an added “GPL exception” explicitly allowing it to be distributed in compiled form when linked to OpenSSL versions prior to v. 3.0.0 (older versions of OpenSSL have a license clause incompatible with the GPL unless OpenSSL can be regarded as a “System Library”, which it is in *BSD). Many Linux distributions treat OpenSSL as a “System Library”, but some (e.g. Debian) do not: in this case, the issue is solved by linking with OpenSSL-3.0.0 or later.

Building UxPlay from source

Either download and unzip UxPlay-master.zip, or (if git is installed): “git clone https://github.com/FDH2/UxPlay”. You can also download a recent or earlier version listed in Releases.

Building UxPlay on Linux (or *BSD):

Debian-based systems:

(Adapt these instructions for non-Debian-based Linuxes or *BSD; for macOS, see specific instruction below). See Troubleshooting below for help with any difficulties.

You need a C/C++ compiler (e.g. g++) with the standard development libraries installed. Debian-based systems provide a package “build-essential” for use in compiling software. You also need pkg-config: if it is not found by “which pkg-config”, install pkg-config or its work-alike replacement pkgconf. Also make sure that cmake>=3.10 is installed: “sudo apt install cmake” (add build-essential and pkg-config (or pkgconf) to this if needed).

Make sure that your distribution provides OpenSSL 1.1.1 or later, and libplist 2.0 or later. (This means Debian 10 “Buster” based systems (e.g, Ubuntu 18.04) or newer; on Debian 10 systems “libplist” is an older version, you need “libplist3”.) If it does not, you may need to build and install these from source (see instructions at the end of this README).

If you have a non-standard OpenSSL installation, you may need to set the environment variable OPENSSL_ROOT_DIR (e.g. , “export OPENSSL_ROOT_DIR=/usr/local/lib64” if that is where it is installed). Similarly, for non-standard (or multiple) GStreamer installations, set the environment variable GSTREAMER_ROOT_DIR to the directory that contains the “…/gstreamer-1.0/” directory of the gstreamer installation that UxPlay should use (if this is e.g. “~/my_gstreamer/lib/gstreamer-1.0/”, set this location with “export GSTREAMER_ROOT_DIR=$HOME/my_gstreamer/lib”).

In a terminal window, change directories to the source directory of the downloaded source code (“UxPlay-*”, “*” = “master” or the release tag for zipfile downloads, “UxPlay” for “git clone” downloads), then follow the instructions below:

Note: By default UxPlay will be built with optimization for the computer it is built on; when this is not the case, as when you are packaging for a distribution, use the cmake option -DNO_MARCH_NATIVE=ON.

If you use X11 Windows on Linux or *BSD, and wish to toggle in/out of fullscreen mode with a keypress (F11 or Alt_L+Enter) UxPlay needs to be built with a dependence on X11. Starting with UxPlay-1.59, this will be done by default IF the X11 development libraries are installed and detected. Install these with “sudo apt install libx11-dev”. If GStreamer < 1.20 is detected, a fix needed by screen-sharing apps (e.g., Zoom) will also be made.

  1. sudo apt install libssl-dev libplist-dev“. (unless you need to build OpenSSL and libplist from source).
  2. sudo apt install libavahi-compat-libdnssd-dev
  3. sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev. (*Skip if you built Gstreamer from source)
  4. cmake . (For a cleaner build, which is useful if you modify the source, replace this bymkdir build; cd build; cmake ..”: you can then delete the contents of the build directory if needed, without affecting the source.) Also add any cmake “-D” options here as needed (e.g, -DNO_X11_DEPS=ON or -DNO_MARCH_NATIVE=ON).
  5. make
  6. sudo make install (you can afterwards uninstall with sudo make uninstall in the same directory in which this was run).

This installs the executable file “uxplay” to /usr/local/bin, (and installs a manpage to somewhere standard like /usr/local/share/man/man1 and README files to somewhere like /usr/local/share/doc/uxplay). (If “man uxplay” fails, check if $MANPATH is set: if so, the path to the manpage (usually /usr/local/share/man/) needs to be added to $MANPATH .) The uxplay executable can also be found in the build directory after the build process, if you wish to test before installing (in which case the GStreamer plugins must first be installed).

Building on non-Debian Linux and *BSD

**For those with RPM-based distributions, a RPM spec file uxplay.spec is also available: see Building an installable rpm package.

Building an installable RPM package

First-time RPM builders should first install the rpm-build and rpmdevtools packages, then create the rpmbuild tree with “rpmdev-setuptree”. Then download and copy uxplay.spec into ~/rpmbuild/SPECS. In that directory, run “pmdev-spectool -g -R uxplay.spec” to download the corresponding source file uxplay-*.tar.gz into ~/rpmbuild/SOURCES (“rpmdev-spectool” may also be just called “spectool”); then run “rpmbuild -ba uxplay.spec” (you will need to install any required dependencies this reports). This should create the uxplay RPM package in a subdirectory of ~/rpmbuild/RPMS. (uxplay.spec is tested on Fedora 38, Rocky Linux 9.2, openSUSE Leap 15.5, Mageia 9, OpenMandriva, PCLinuxOS; it can be easily modified to include dependency lists for other RPM-based distributions.)

Running UxPlay

Installing plugins (Debian-based Linux distributions, including Ubuntu and Raspberry Pi OS) (skip if you built a complete GStreamer from source)

Next install the GStreamer plugins that are needed with sudo apt install gstreamer1.0-<plugin>. Values of <plugin> required are:

  1. plugins-base
  2. libav” (for sound),
  3. plugins-good” (for v4l2 hardware h264 decoding)
  4. plugins-bad” (for h264 decoding).

Debian-based distributions split some of the plugin packages into smaller pieces: some that may also be needed include “gl” for OpenGL support (this provides the “-vs glimagesink” videosink, which can be very useful in many systems (including Raspberry Pi), and should always be used when using h264/h265 decoding by a NVIDIA GPU), “gtk3” (which provides the “-vs gtksink” videosink), and “x” for X11 support, although these may already be installed. If sound is not working, “alsa”“,”pulseaudio”, or “pipewire” plugins may need to be installed, depending on how your audio is set up.

Installing plugins (Non-Debian-based Linux or *BSD) (skip if you built a complete GStreamer from source)

In some cases, because of patent issues, the libav plugin feature avdec_aac needed for decoding AAC audio in mirror mode is not provided in the official distribution: get it from community repositories for those distributions. _Note: the (deprecated) “vaapi” packages listed below are no longer recommended: newer “va” versions of the VA-API plugins for Intel/AMD graphics are provided by *-plugins-bad._

Starting and running UxPlay

Since UxPlay-1.64, UxPlay can be started with options read from a configuration file, which will be the first found of (1) a file with a path given by environment variable $UXPLAYRC, (2) ~/.uxplayrc in the user’s home directory (“~”), (3) ~/.config/uxplayrc. The format is one option per line, omitting the initial "-" of the command-line option. Lines in the configuration file beginning with "#" are treated as comments and ignored.

Run uxplay in a terminal window. On some systems, you can specify fullscreen mode with the -fs option, or toggle into and out of fullscreen mode with F11 or (held-down left Alt)+Enter keys. Use Ctrl-C (or close the window) to terminate it when done.

If the UxPlay server is not seen by the iOS client’s drop-down “Screen Mirroring” panel, check that your DNS-SD server (usually avahi-daemon) is running: do this in a terminal window with systemctl status avahi-daemon. If this shows the avahi-daemon is not running, control it with sudo systemctl [start,stop,enable,disable] avahi-daemon (on non-systemd systems, such as *BSD, use sudo service avahi-daemon [status, start, stop, restart, ...]). If UxPlay is seen, but the client fails to connect when it is selected, there may be a firewall on the server that prevents UxPlay from receiving client connection requests unless some network ports are opened: if a firewall is active, also open UDP port 5353 (for mDNS queries) needed by Avahi. See Troubleshooting below for help with this or other problems.

Note that there is now an alternative Service Discovery method using a Bluetooth LE beacon. See the instructions on Bluetooth beacon setup.