本帖最后由 羽先生 于 2025-5-19 13:43 编辑
我用的是 debian 12 发行版:
Airplay
编译安装 nqptp
git clone https://github.com/mikebrady/nqptp.git
cd nqptp
autoreconf -fi
./configure --with-systemd-startup
make
sudo make install
编译安装 alac
git clone https://github.com/mikebrady/alac.git
cd alac
autoreconf -fi
./configure
make
sudo make install
sudo ldconfig
编译安装 shairport-sync
sudo apt install --no-install-recommends build-essential git autoconf automake libtool libpopt-dev libconfig-dev libasound2-dev avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev libplist-dev libsodium-dev libavutil-dev libavcodec-dev libavformat-dev uuid-dev libgcrypt-dev libmosquitto-dev xxd
git clone https://github.com/mikebrady/shairport-sync.git
cd shairport-sync
autoreconf -fi
./configure --sysconfdir=/etc --with-alsa --with-soxr --with-apple-alac --with-metadata --with-mqtt-client --with-avahi --with-ssl=openssl --with-systemd --with-airplay-2
make
sudo make install
启用服务
修改 /etc/shairport-sync.conf 来配置服务器
sudo systemctl daemon-reload
sudo systemctl enable nqptp
sudo systemctl start nqptp
sudo systemctl enable shairport-sync
sudo systemctl start shairport-sync
DLNA
编译安装 gmrender-resurrect
sudo apt install --no-install-recommends build-essential autoconf automake libtool pkg-config libupnp-dev libgstreamer1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-alsa git
git clone https://github.com/hzeller/gmrender-resurrect.git
目前主线有 bug ,无法将渲染器名设置为中文,我们引入这个 pr 解决这个问题:
cd gmrender-resurrect
git fetch origin pull/284/head:pr-284
git checkout pr-284
继续编译:
./autogen.sh
./configure
make
sudo make install
配置服务
编写 /usr/lib/systemd/system/gmrender-resurrect.service 内容如下:
[Unit]
Description=gmrender-resurrect service
After=network-online.target sound.target
Requires=network-online.target sound.target
[Service]
EnvironmentFile=/etc/default/gmrender
ExecStart=/usr/local/bin/gmediarender -f "$UPNP_DEVICE_NAME" -u "$UPNP_UUID" \
--gstout-audiosink=alsasink --gstout-audiodevice "$AUDIO_DEVICE" \
--logfile=/tmp/gmediarenderer.log --gstout-initial-volume-db=-10
Restart=always
[Install]
WantedBy=multi-user.target
执行如下命令生成配置文件
sudo tee /etc/default/gmrender <<EOF
UPNP_UUID=$(ip link show | awk '/ether/ {print "salt -" $2}' | head -1 | md5sum | awk '{print $1}')
UPNP_DEVICE_NAME="MyMediaRenderer"
AUDIO_DEVICE="sysdefault"
EOF
启用服务
sudo systemctl daemon-reload
sudo systemctl enable gmrender-resurrect.service
sudo systemctl start gmrender-resurrect.service
|