DVB-D (DVB over DLNA)

Imre Rad
3 min readApr 13, 2023

--

Disclaimer: the project I’m outlining here, is highly experimental —kind of a PoC. Also, DVB-D is not a consortium standard for broadcast transmission, it is rather a pun I made up for fun.

After a long and painful renovation, I finally moved to a family house few years ago. But I made a mistake, I noticed only when everything was (thought to be) ready, that the TV wall socket in two of the rooms were broken: no signal. I was trying to investigate them for a while, but besides “it is not working” I couldn’t really make any conclusions. What are my remaining options on the table?

I don’t prefer any visible cables, neither antennas. Luckily both of the affected rooms are kind of guest rooms, so they don’t justify the intrusive solutions (like drilling or carving). Instead, I chose a small hobby project to solve this.

WiFi coverage was decent everywhere inside— that was a design goal. Furthermore, I also had a home server with Linux next to the modem of the TV provider. Requirements:

  • stream the MPEG2 transport stream over WiFi
  • without transcoding anything!
  • without any further gadgets next to the TV (e.g. no chromecast/miracast/raspberry anywhere this time)
  • being able to browse the channels using the native interface of the TV
  • works without android apps and Android TV (my provider does not support it)

As a start, I bought a cheap USB based DVB adapter (Astrometa), you can find it on AliExpress for around $20.

Cut and patched some small coax cables, using a tap I routed the signal to the home server. Going through the learning curve of the numerous and mostly out-dated command line tools of dvb related video4linux tools, I finally managed to scan the subscription for channels.

Having some experience with it from long ago, I knew meeting my goals should be possible using DLNA. However, I didn’t find any off-the-shelf open source projects to do this. Actually, besides IPTV streaming, I didn’t really find anything relevant :) IPTV look promising, smart TVs usually feature applications to play that. However, it comes with a limitation, you need to lock the frequency of the tuner, so I could expose only a subset of the channels at once. I decided to go on with my original DLNA idea and build something experimental on my own.

I didn’t have the time and motivation to write a DLNA server from scratch. Luckily, I found DMS, a lightweight and decent one written in Golang. It was limited to serving static files, so I contributed a new feature to generate streams on the fly. (Actually, it was needed for yet another home project, I can finally play the RTSP stream of surveillance cameras around the house on the TVs.) This is controlled using specific metadata files — files with .dms.json suffix. They describe the content, like the title and the command to be executed to feed the content through the stdout. Perfect fit for ffmpeg :)

I also encountered issues on my Samsung Frame TV — content directory was empty. Troubleshooting was long and annoying — comparing the requests and responses between multiple implementations and devices to understand . I managed to identify the root cause: it turned out to be some Samsung-specific weirdness with entity encoding.

The next step was building a lightweight tooling to scan for DVB channels and converting them into .dms.json files with the right dvbv5-zap files to be executed to access the content. This required some experimenting, my LG and Samsung televisions didn’t really enjoy playing the raw transport stream this way, so I decided to repackage the stream into matroska container… And it finally started working! You can find the project here.

It is a bit fragile, inconvenient but works. It was fun :)

--

--

Imre Rad

Software developer daytime, security researcher in freetime