Server Topic
   >  Introduction to DLNA
   >  Using DLNA
   >  Installing MediaTomb
   >  Starting & Stopping MediaTomb
   >  Accessing the MediaTomb GUI
   >  Configuring MediaTomb
   >  Adding Content to MediaTomb
   >  Removing Content from MediaTomb
   >  Configuring Transcoding
   >  Debugging MediaTomb

 

Transcoding in MediaTomb

What is Transcoding?

One of the most useful features of MediaTomb is that it allows you to transcode files from one format to another.. although it does take a bit of work to configure it

Sometimes, your DLNA device simply does not support the format that your files are stored in on your server. For example, perhaps your internet Tv or your Hi-Fi only supports MP3 format, whereas all your CDs are stored in OGG/Vorbis (.ogg) format on your computer. Fear not! One of the most useful features of MediaTomb is that it allows you to transcode files from one format to another.. although it does take a bit of work to configure it! In this chapter, we take a look at the general configuration process for transcoding.


Source and Destination Formats

Probably the first thing you need to identify is simply:

  • The MIME type of file that you want to convert (-the source)
  • The MIME type of file that you want to convert it to (-the destination)

The best way to identify the source MIME type is to run the following command against one of the files you wish to convert:

$ file -i <source file>

For example, the following shows the MIME type of the existing file as "application/ogg":

$ file -i /home/fredb/Music/artist1/album1/song1.ogg
song1.ogg: application/ogg; charset=binary
$

The best way to identify the best destination MIME type is to consult the manual of the DLNA device (-these days, the full manual tends to be supplied on CD-ROM rather than in print). This should state which formats the device supports.

Once you have determined the source and destination MIME types you may have to manually code the mapping of file extensions to MIME types in the /etc/mediatomb/config.xml configuration file (-if you have the libmagic module installed, this is not necessary). In the example below we have mapped .mp3 to "audio/mpeg" and .ogg to "application/ogg":

<extension-mimetype ignore-unknown="no">
   <map from="mp3" to="audio/mpeg"/>
   <map from="ogg" to="application/ogg"/>
</extension-mimetype>

Creating a Profile

A transcoding profile tells MediaTomb how to convert a file to another format. For every conversion you wish to make, you need to define (-or adapt) one of these and place it within the <profiles> .. </profiles> section of the /etc/mediatomb/config.xml configuration file. The basic format of a transcoding profile is:

<profile name="<Unique Name>" enabled="yes" type="external">
   <mimetype><Target MIME Type> </mimetype>
   <accept-url>no</accept-url>
   <first-resource>yes</first-resource>
   <agent command="<Converter Program>" arguments="<Program Arguments>"/>
   <buffer size="<Buffer Size>" chunk-size="<Chunk Size>" fill-size="<Fill Size>"/>
</profile>

For example, to translate an .ogg file into .wav format, you might define the following profile:

<profile name="oggtomp3" enabled="yes" type="external">
   <mimetype>audio/wav</mimetype>
   <accept-url>no</accept-url>
   <first-resource>yes</first-resource>
   <accept-ogg-theora>no</accept-ogg-theora>
   <agent command="ogg123" arguments="-d wav -f %out %in"/>
   <buffer size="1048576" chunk-size="131072" fill-size="262144"/>
</profile>

Specifying when to use the Profile

Once the profile has been defined, you need to tell MediaTomb when to use it. This is done by adding one or more lines to the <mimetype-profile-mappings> .. </mimetype-profile-mappings> section of the /etc/mediatomb/config.xml configuration file, specifying which source MIME types the profile should be applied to. The basic format of this is:

<transcode mimetype="<Source MIME Type>" using="<Unique Profile Name>"/>

For example, if we wanted the "myProfile" transcoding profile applied to all .ogg input files, we would add:

<transcode mimetype="application/ogg" using="myProfile"/>

Once all the changes have been made to the MediaTomb configuration, restart MediaTomb to pick up the changes.



HomeSite IndexDesktop GuideServer GuideHints and TipsHardware CornerVideo SectionContact Us

 sitelock verified Firefox Download Button