Introduction

Blog & News

About the Model Railroad

RTAC Software

Videos

The Randall Museum in San Francisco hosts a large HO-scale model model railroad. Created by the Golden Gate Model Railroad Club starting in 1961, the layout was donated to the Museum in 2015. Since then I have started automatizing trains running on the layout. I am also the model railroad maintainer. This blog describes various updates on the Randall project and I maintain a separate blog for all my electronics not directly related to Randall.

2021-12-23 - Update to Vision Computer: VLC with RTSP on Debian Bullseye

Category Randall

I’ve spent the last couple weeks doing background computer maintenance mostly. The kind of stuff nobody at the layout will notice, because things magically get fixed before they are too broken.

If you don’t like computer stuff, you can skip this one as we’re going to get deep in the weeds with Linux commands.

About a month ago, I fixed the last issue I was having with the Vision software on the Vision computer at the museum. Unfortunately even though I improved the software side, the computer itself decided not to cooperate and the workaround I have to force it to turn on automatically stopped working.

Let’s try to summarize the core issue. See I don’t think the museum staff should have the burden of going around and pushing the on button of every single computer in the museum, and surely not in the railroad exhibit. Yet these computers and laptops obstine themselves in staying off when the power is turned on. And that’s why I love these Lenovo T series laptops as they have that magical “Power on AC attach” option in their BIOS.

Except Vision is a Lenovo Yoga S15, and the S-series does not have the “Power on AC attach” option in their BIOS, which I didn’t know at first -- I thought all Lenovo laptops had that option, but nope they don’t. Which brings the side question of how I’d figure that out upfront, and my investigation is that it seems related to the presence of the “Intel AMT” option in the BIOS and is related to those laptops that have the “Intel vPro” sticker. So maybe that’s a way to figure that out when looking at machines before getting them.

So no problem, after mulling at the problem for a while, I found a workaround: the RTC wake up! I created a udev rule that is triggered on power down and schedules an RTC wake up in 5 minutes. When the laptop is powered back later, the 5 minutes have elapsed and the laptop turns on. Worked very well for a while, till it didn’t.

So fine, I took that computer home, realized it would take a while to get it working again as I want. Instead I swapped it for one of my Yoga X1 which has the desired startup option. That involved entirely reformatting that computer, reinstalling a fresh Debian 11 ”bullseye” on it, and installing all the software on it. That’s a full week-end spent right there.

The new computer with Vision works fine at home so I finally brought it to the museum. And surprise, it can’t connect to the IP cameras providing the live video feed of the trains on the layout. The cameras work fine, the network is fine, but no way to get the RTSP stream out of these cameras from that computer. Works fine on others.

Looking at various things… the usual culprits: IP route issue? No, I can ping these and access the http admin page. NAT or firewall? Nope, nothing in ip tables that could be related.

Along the way, I notice this isn’t quite right:

$ sudo route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

default         pir             0.0.0.0         UG    0      0        0 wlan0

link-local      0.0.0.0         255.255.0.0     U     1000   0        0 wlan0

192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0

192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

Duh, wlan0 should not be before eth0… it should be after. That’s why I went to all the trouble to bring wired ethernet to that machine. OK fine that’s easily resolved by adding a metric setting for each network:

$ sudo vim /etc/network/interfaces

[...]

allow-hotplug eth0

iface eth0 inet dhcp

metric 0

auto wlan0

allow-hotplug wlan0

iface wlan0 inet dhcp

wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

metric 1

Of course that won’t fix the RTSP problem. So after wasting a ton of time, I narrowed it down to be… a VLC problem specifically on Debian 11 ”bullseye”. That’s because in Vision, I capture and play the live camera feeds using custom viewers by instances of VLCj in Direct Rendering, and that uses the VLC libraries installed on the platform.

This forum post indicates it’s not even a VLC issue itself. It’s due to some genius folk at Debian deciding to just remove the liblivemedia VLC plugin which is the one handling RTSP here. And then they wonder why Linux and the FOSS community gets a bad rap from end-users…

So nowm how do I get this fixed?… The initial forum post was cryptic with the “just recompile it” suggestion. Sure, that’s fine when you know what to do. I guess after a day of work on that, now I know, more or less. Took a lot of guesswork though, so here’s the highlight summary of what worked in the end, without the back-and-forth steps in between:

First we’re going to need to install that “liblivemedia” but it’s been removed from debian, so we can just “apt install” it.

Instead we need to search in the http://snapshot.debian.org/ archives for that package: For example searching for “liblivemedia64” on the binary search on the sidebar of that side… https://snapshot.debian.org/binary/liblivemedia64/ this shows several options, of which I need to pick one reasonable version, install it, realize it needs dependencies, so go search for them, then rinse and repeat till I have it all. In the end I did something like this:

$ wget

https://snapshot.debian.org/archive/debian/20190819T095315Z/pool/main/libl/liblivemedia/liblivemedia64_2018.11.26-1.1%2Bb1_amd64.deb 

$ wget https://snapshot.debian.org/archive/debian/20190819T095315Z/pool/main/libl/liblivemedia/libbasicusageenvironment1_2018.11.26-1.1%2Bb1_amd64.deb 

$ wget https://snapshot.debian.org/archive/debian/20190819T095315Z/pool/main/libl/liblivemedia/libgroupsock8_2018.11.26-1.1%2Bb1_amd64.deb 

$ wget https://snapshot.debian.org/archive/debian/20190819T095315Z/pool/main/libl/liblivemedia/libusageenvironment3_2018.11.26-1.1%2Bb1_amd64.deb

$ wget https://snapshot.debian.org/archive/debian/20190819T095315Z/pool/main/libl/liblivemedia/liblivemedia-dev_2018.11.26-1.1%2Bb1_amd64.deb 

$ sudo apt install ./lib*

Also added the -dev dependency since we’re going to need it later.

OK but that’s still not enough because VLC has been compiled without the library support, and for that it turns out we need the “live555” module (seriously, what’s with the names?). Trying to do the typical “apt source vlc” doesn’t really do much and that tells me I need to get a git repo. Then I also needed to figure and install all the dependencies to build a deb package.

$ git clone https://salsa.debian.org/multimedia-team/vlc.git

$ sudo apt install dh-autoreconf build-essential devscripts

That also required installing a few bazillion dev dependencies for VLC, and there’s one “libidn-dev” that I could not find anywhere so I got the closest “libidn11-dev” instead and had to modify the debian/control file accordingly:

$ sudo apt install liba52-0.7.4-dev libaa1-dev libarchive-dev  libaribb24-dev libasound2-dev  libass-dev  libavahi-client-dev libavc1394-dev  libavcodec-dev  libavformat-dev  libbluray-dev  libcaca-dev  libcairo2-dev  libcddb2-dev libchromaprint-dev  libdav1d-dev libdbus-1-dev  libdc1394-dev  libdca-dev libdvbpsi-dev  libdvdnav-dev  libdvdread-dev  libebml-dev  libegl1-mesa-dev libfaad-dev libflac-dev  libfluidsynth-dev  libfreetype-dev libfribidi-dev libgl1-mesa-dev libgles2-mesa-dev libgnutls28-dev  libgtk-3-dev libharfbuzz-dev  libiso9660-dev libjack-dev libkate-dev  liblirc-dev liblua5.2-dev libmad0-dev libmatroska-dev  libmpcdec-dev libmpeg2-4-dev libmpg123-dev libmtp-dev  libncursesw5-dev libnfs-dev  libnotify-dev libogg-dev  libmodplug-dev  libopus-dev  libplacebo-dev  libpng-dev libpostproc-dev  libprotobuf-dev  libpulse-dev  libqt5svg5-dev libqt5x11extras5-dev libraw1394-dev  libresid-builder-dev librsvg2-dev libsamplerate0-dev libsdl-image1.2-dev libsdl1.2-dev  libsecret-1-dev libshine-dev  libshout-dev libsidplay2-dev libsmbclient-dev libsndio-dev libsoxr-dev  libspatialaudio-dev libspeex-dev  libspeexdsp-dev  libssh2-1-dev libswscale-dev  libsystemd-dev libtag1-dev  libtheora-dev  libtwolame-dev  libudev-dev libupnp-dev libv4l-dev libva-dev libvcdinfo-dev  libvdpau-dev libvncserver-dev  libvorbis-dev libx264-dev  libx265-dev libxcb-composite0-dev libxcb-keysyms1-dev  libxcb-randr0-dev  libxcb-shm0-dev libxcb-xv0-dev  libxext-dev libxi-dev libxinerama-dev libxpm-dev libzvbi-dev  lua5.2 protobuf-compiler qtbase5-dev  qtbase5-private-dev  wayland-protocols zlib1g-dev zsh

$ sudo apt install libidn11-dev        

$ vim debian/control

        s/libidn-dev/libidn11-dev

So now we’re ready to build (I actually did a build using the version out of the box to check it was building before I did any change). Yet we still have to activate that “live555” module we want. I tried to naively enable it in debian/rules and that didn’t work as it was missing something else… so plan B: this is a git repository, thus I can use it to find the commit where that lib was removed and roll it back:

$ git log

s/live555 ⇒ 4b907f34c

$ git revert 4b907f34c

(that will clash with the libidn11-dev change in debian/control so just stash it first + unstash or restore the file and redo the change manually.)

Finally we can build VLC:

$ dpkg-buildpackage -us -uc -rfakeroot

And in the end… I decided to not use that VLC build. All I care is for the dynamic live555 module, so I can just copy it in the target plugin directory:

$ sudo cp -v \
debian/vlc-plugin-base/usr/lib/x86_64-linux-gnu/vlc/plugins/access/liblive555_plugin.so \
/usr/lib/x86_64-linux-gnu/vlc/plugins/access/liblive555_plugin.so

And now trying vlc or cvlc, it can play RTSP streams from the live cameras just fine.

The only downside of this approach at the end is that next time I do an “apt upgrade”, I need to either pin VLC so that it doesn’t get updated, or preferably I need to do all this again to rebuild the “liblive555_plugin.so” in case there’s an ABI change.


 Generated on 2024-12-21 by Rig4j 0.1-Exp-f2c0035