1.9 KiB
+++ title = "Streaming camera output trough UDP" date = 2024-11-14
[taxonomies] categories = ["Linux"]
[extra] author = "Emil Miler" +++
I had an interesting assignment to set up a low-latency video stream from a camera to a TV screen on the third floor of a building for a short event. I came up with a simple solution: streaming it directly over UDP using OBS and capturing the stream with MPV.
Intro
The event took place on a stage that needed to be streamed to two screens -- one in the lobby on the ground floor and another deep inside the third floor. The audio team provided a clean audio mix directly to my camera’s audio mixer.
The building, located in the old town of Prague, had a complicated floor plan, as you might imagine. Connecting to the ground floor screen was straightforward with a direct HDMI link, but reaching the third floor was more challenging without an HDMI-to-Ethernet extender, which I didn’t have.
My solution was to lay a UTP cable from the TV on the third floor to my laptop with an HDMI capture card, configure direct routing, and stream from OBS to a client that would output the video and audio over HDMI to the TV.
Server setup
First I set up the network:
ip a add 192.168.66.1/24 dev eth0
ip route add 192.168.66.2 dev eth0
The OBS part was a little tricky. I am sure this can be highly optimized.
Client setup
Again, static adress is needed, but no routes have to be defined this time.
ip a add 192.168.66.2/24 dev eth0
The stream can then by captured with MPV:
mpv --no-cache udp://@0.0.0.0:8081
It does have some latency, but since the TV was hidden deep in the building, it was not a big issue. I might try using something like UltraGrid in the future.