MediaTomb UPnP Server

After being less than satisfied for MythTV’s performance serving random stuff on UPnP (DVR side is another story, it works), I figured to check out the alternatives (linux+ opensource+UPnP). I liked the idea of UPnP though. Unsurprisingly there are quite a few options, and as always, most of them are alpha/research projects/toys/proof of concepts/unfinished prototypes etc. After a quick googling I decided to go with MediaTomb.

UPnP PhotoFeatures (pros from my POV):

  • can serve audio/video/photos over UPnP (by DLNA)
  • shows media by date/type/directory
  • easy to use
  • web interface
  • transcoding!
  • file identification with file -i (magic)

Transcoding is an intresting feature. It allows feeding pretty much anything to TV that doesn’t accept much beyond avi/mpeg-ts containing mpeg2/h264 with some vtags (divx and avc1 seem to work), audio support being mp2/mp3/ac3.

UPnP videoSo suddenly my Panasonic G20 plasma can play h264 in Quicktime/MP4 container with minimal hassle. Container gets changed on the fly. Or avi with odd audio, just transcode it into mp2, or transcode video bitstream into mpeg2.

It turns out that the same old Eee 1000 with N270 atom cpu can transcode at least SD stuff into mpeg2/mp2 real time at 30 fps. Simple container change is of course pretty much zero operation.

Cons: transcoding works by mimetype. It means that media is essentially sorted by container, not codec. That may turn out to be problematic for transcoding. However, so far so good.

Some technicalities: on Ubuntu 12.04, MediaTomb can be installed with apt-get install mediatomb-daemon. It has a configuration file at /etc/mediatomb. Rest of the stuff is stored in a database, either SQLite or MySQL. Web interface is a nice way to add directories. Check out the address from the log, /var/log/mediatomb.

FFmpeg transcoding needs (in config.xml):

<transcoding enabled="yes">    

    <transcode mimetype="video/x-flv" using="vlcmpeg"/>      
    <transcode mimetype="audio/x-flac" using="oggflac2raw"/>      
    <transcode mimetype="application/ogg" using="ffmpeg2"/>      
    <transcode mimetype="video/ogg" using="ffmpeg2"/>      
    <transcode mimetype="video/quicktime" using="ffmpeg"/>      
    <transcode mimetype="video/mp4" using="ffmpeg"/>      
    <transcode mimetype="video/x-msvideo" using="ffmpeg2"/>    

  <profile name="ffmpeg" enabled="yes" type="external">        
  <mimetype>video/mpeg</mimetype> <!-- result -->        
  <agent command="ffmpeg" arguments="-y -fflags +genpts -vcodec copy -vbsf h264_mp4toannexb -i %in -acodec mp2 -f mpegts %out"/>        
  <buffer size="1048576" chunk-size="131072" fill-size="262144"/>      
<profile name="ffmpeg2" enabled="yes" type="external">        
  <mimetype>video/mpeg</mimetype> <!-- result -->        
  <agent command="ffmpeg" arguments="-y -threads 2 -i %in -vcodec mpeg2video -qscale 3 -acodec mp2 -f mpegts %out"/>        
  <buffer size="1048576" chunk-size="131072" fill-size="262144"/>      

There are two profiles, one for container change and another for actual transcoding. No magic needed, it just works. Or so. Figuring out those required options like -vbsf h264_mp4toannexb took some googling.

About magic, file doesn’t seem to understand MPEG-TS, so it’s a good idea to add

      <extension-mimetype ignore-unknown="no">
        <map from="m2t" to="video/mpeg" />

Now, only if FFmpeg could transcode subtitles into DVB-format properly.. Maybe some day.  There’s some code, but it’s unfinished.

Kurko 2 Teräs


Ihan ookoo, mutta ei sitten kuitenkaan. 12 rastiväli katastrofi, 9 minsaa kiertelyä. Muuten kyllä ookoo, paikotellen jopa ihan hyvää tekemistä. Kunto ei vaan riittänyt letkojen vauhtiin. Ensin tippui nelosvälillä letkasta, sitten jostain syystä letka otti 8 välillä taas takaa kiinni, mutta 10 mennessä taas selät katosivat pimeyteen. Sykkeet sen mukaiset. 12 välillä myös toinen akku hyytyi 33 min kohdalla, se lataaminenko?

Lopputulos vahvasti ynnä muissa.

Maasto yllättävänkin juostavaa. Rytöistä, kivistä, mutta jostain syystä suht vauhdikasta. Korkeuserot ja vauhti hyydytti. 40 km pelipaikalle, josta viimeiset 10 pientä uraa.