Subtitles via DLNA with Mediatomb (Linux) on Smart TVs

The problem

I recently bought a LG Smart TV. To be more comfortable, installed Mediatomb on my Linux to be able to access my videos via DLNA sharing, But I could not see them subtitles. I imagine that the problem is both the protocol (fuçando that quickly seems not specify anything about), how to implement server and client. I saw that managed to change the MediaTomb to provide subtitles for TV Samsung, implementing proprietary extensions to the original protocol, but found nothing on LG TVs. The only solution I've seen out there is using transcoding and re-encode the video with subtitles in real time. Seriously? This does not seem a good solution, because it will consume the processing machine and also because it will decrease the quality of the video. Out this proposal, I did not find any other.

The idea

Since the subtitle must be within video, my best option would be to find a way to put in it without recoding. I had read a little about the MKV format - who often download videos have come across this type of file - which is not a video format but a video container. Therein lies the clever: it can contain video, audio and subtitles! This way, already have the output format of our file with subtitles. Get to work.

The execution

More research on the internet showed me that there is an application called mkvmerge (available in the Debian package mkvtoolnix), whose function is to create the MKV files you need, adding audio sources, video and legends. Only that it is has many options! Luckily there is another graphics application called mkvmerge-gui where you say what you want into the file and it, besides generating, also shows you the options from the command line! This way, I cleaned unnecessary stuff, and created a simple script where you pass the name of the video file and the destination directory for the generated file and it creates an MKV file with subtitled video (you need a subtitle file with the same name of the video file). Here is the script::

This is not exactly perfect yet, but it works well for what we need (having problems, propose changes in my github!)


This way, just get a video with the caption with the same name of the video and generate a MKV in any directory that you have configured for load mediatomb. For example:

And take a look, is very fast! That's what I was looking for!


Configuring Mediatomb to display a frame of video as cover

If you want your TV to show a frame of the video as the cover, only enable a setting in the mediatomb /etc/mediatomb/config.xml, section on extended-runtime-options:

Adding a tag to indicate watched videos

This setting is nice to know if you ever watched a video or not. It will put an asterisk before the name of the file. The setting is in the same section extended-runtime-options of the previous tip:

Resuming the video from where you left off

To be honest, I'm not sure that's what I wiggled that made the videos could be resumed starting from where I left off, but I think so. 🙂 Acho legal ativar essa opção uma vez que não dá para avançar ou voltar o vídeo. The setup is basically to enable protocol extensions:


One thought on “Subtitles via DLNA with Mediatomb (Linux) on Smart TVs

  1. Muito boa dica, funcionou muito bem. Agora tenho uma dúvida, como faço para corrigir problemas de codificação da legenda com essa solução?? As palavras com acentuação estão aparecendo com caracteres especiais.

Leave a Reply