debian 官方从11开始,不再提供支持 rtsp 的 VLC deb 包,通过 libvlc 播放 rtsp 也无法实现,因此需要自己编译。
安装编译环境,编译依赖库以及 contrib 第三方工具
sudo apt install git g++ make libtool automake autopoint pkg-config flex bison lua5.2
sudo apt build-dep vlc
sudo apt install subversion yasm cvs cmake ragel
建议添加阿里云的镜像源
sudo nano /etc/apt/sources.list.d/aliyun.list
# 添加 debian 阿里云源到 /etc/apt/sources.list
deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
sudo apt update
下载 vlc 源代码,解压
wget http://download.videolan.org/pub/videolan/vlc/3.0.21/vlc-3.0.21.tar.xz
tar xvJf vlc-3.0.21.tar.xz
cd vlc-3.0.21
创建编译目录
cd contrib
mkdir native && cd native
../bootstrap
下载 live555 源代码并编译,注意不是 live555 的最新版本,而是 videolan 提供的特定版本
wget http://downloads.videolan.org/pub/contrib/live555/live.2016.11.28.tar.gz -O ../contrib/tarballs/live.2016.11.28.tar.gz
make .live555
配置 vlc 的编译参数,关键是指定安装位置,以及启用 rtsp,其他可选参数还有 --disable-alsa --disable-chromaprint --enable-shared 等, 开始编译
../../configure --prefix=/usr --enable-realrtsp --enable-live555
make
编译完成后,查看是否已支持 live555
./vlc --list | grep live555
安装
make install
如果未安装在 /usr 下,想引用 libvlc 需要自己添加环境变量。也可以修改 /etc/ld.so.conf 或添加 /etc/ld.so.conf.d/libvlc.conf,填写"自定义的安装目录/lib",然后执行
sudo ldconfig
本文参考
https://wiki.videolan.org/UnixCompile/
https://wiki.videolan.org/Configure/