Ok the title is a bit of a cheat but here goes… Bambu Labs printers can stream RTSP video from their bed cameras… but it’s RTSP over SSL, otherwise known as RTSPS. The problem is, there are very few clients that support this. So, to get around this, I first tried an NGINX stream proxy… that did not work. Thankfully, I found an alternative that works slick.
1) Set up your printer for RTSP streaming
This involves tricking the printer by putting it in LAN ONLY mode, getting a special LAC ACCESS CODE, rebooting the printer, confirming the stream works (took my printer several minutes of just waiting after reboot to get the stream uh… streaming)… then turning off LAN ONLY mode after… and it should remain working. This guy covers how to do this in great detail;
Just in case his site kicks off, I printed to PDF…
Bambulab X1C Camera in Home Assistant.pdf (2.4 MB)
2) Set up a little VM or docker
Next you’re going to set up a way to run MediaMTX which is a great little streaming media server. I have a Ubuntu VM doing some other nginx proxy work on my LAN so I tasked it with this as well.
-
First download GitHub - bluenviron/mediamtx: Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams. latest release and untar it to
/usr/local/bin/mediamtx
and make sure it’s executable withchmod -x
. If you are setting up as a service you can make a user for that or root it or whatever your normal way of doing things is. -
Make a mediamtx.yml file in /etc/mediamtx.yml and put the following;
paths:
bambu:
source: rtsps://bblp:<special-code>@<printer-ip>:322/streaming/live/1
sourceProtocol: tcp
sourceOnDemand: yes
- The above path with create a normal RTSP endpoint called /bambu and that’s really basically it… all the default config just works… except for that pesky TLS security thing.
3) Get TLS cert fingerprint
- For whatever reason, there is no way to have MediaMTX ignore self-signed TLS certs for RTSPS, so you have to fingerprint it first. The process for doing this is outlined in the repo mediamtx.yml file here, but for sanity I will detail the process here;
# If the source is a URL, and the source certificate is self-signed
# or invalid, you can provide the fingerprint of the certificate in order to
# validate it anyway. It can be obtained by running:
# openssl s_client -connect source_ip:source_port </dev/null 2>/dev/null | sed -n '/BEGIN/,/END/p' > server.crt
# openssl x509 -in server.crt -noout -fingerprint -sha256 | cut -d "=" -f2 | tr -d ':'
Once you have the fingerprint, you just need to update your mediamtx.yml file to specify it;
paths:
bambu:
source: rtsps://bblp:<special-code>@<printer-ip>:322/streaming/live/1
sourceProtocol: tcp
sourceOnDemand: yes
sourceFingerprint: F9854F8026E5D11DCE08E8E598C2FCBE307857105E4A76D64364B814B7BE6FFA
- That’s it… run mediamtx and then you can connect one (or more!) regular ol’ RTSP clients to your proxy and it should work. Keep notes about how to get the fingerprint of the TLS cert handy … I still have no idea how long the cert is good for before the printer generates a new one.
4) Connect your RTSP client(s)
Now you can just point your clients at rtsp://<mediamtx-ip>:8554/bambu
and they should just stream.