+++ 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. ![Camera](camera.jpg) 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. ![x210](x210.jpg) 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: ```sh 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. ![OBS Settings](obs-settings.png) ## Client setup Again, static adress is needed, but no routes have to be defined this time. ```sh 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 ``` ![Client](client.jpg) 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](http://www.ultragrid.cz/) in the future.