MediaTomb
Contents |
Introduction
MediaTomb is an open source (GPL) UPnP MediaServer with a nice web user interface. It allows you to stream your digital media through your home network and access it on a variety of UPnP compatible devices.
Preparation
Kernel Configuration
Inotify Support
MediaTomb supports Inotify which is a file-monitoring mechanism that allows MediaTomb to be notified about changes to files immediately. Please consult Section 2.1.5 of the MediaTomb UI documentation for more information.
To enable Inotify support build your kernel with the following options.
| Linux Kernel Configuration: |
File systems ---> [*] Inotify file change notification support [*] Inotify support for userspace |
Package Configuration
Unmask the Ebuild
# echo "net-misc/mediatomb" >> /etc/portage/package.keywords
Configure the USE Flags
| USE | Description |
|---|---|
| curl | Enables support for libcurl. Enable this if you want to transcode online content with transcoders such as FFmpeg that don't support URL's as input. (Recommended) |
| debug | Enables support for debug output. Enable this if you are trying to trace down a bug or a problem. |
| exif | Enables support for libexif. It is used to extract metadata from image files. (Recommended) |
| expat | Enables support for the Expat XML parser. Enable this if you don't want to use the internal XML parser. (Recommended) |
| ffmpeg | Enables support for FFmpeg. It is used to extract metadata from video files. (Recommended) |
| javascript | Enables support for the SpiderMonkey JavaScript engine. It is used to create a virtual container layout based on the metadata extracted from media files. (Recommended) |
| libextractor | Enables support for libextractor. It is used to extract metadata from video files. |
| mysql | Enables support for the MySQL database engine. Enable this if you don't want to use the default SQLite database engine. |
| taglib | Enables support for TagLib. It is used to extract metadata from audio files. Enable this if you don't want to use id3lib. (Recommended) |
| |
# echo "net-misc/mediatomb use" >> /etc/portage/package.use
Installation
To install MediaTomb:
# emerge mediatomb
Configuration
Network Interface
| File: /etc/conf.d/mediatomb |
MEDIATOMB_INTERFACE="interface" |
MySQL Support
To enable MySQL support open the MediaTomb configuration file and set the mysql tag enabled attribute to yes.
| File: /etc/mediatomb/config.xml |
<mysql enabled="yes">
|
You need to set the sqlite3 tag enabled attribute to no.
| File: /etc/mediatomb/config.xml |
<sqlite3 enabled="no">
|
You need to specify values for the host, database, username and password tags.
| File: /etc/mediatomb/config.xml |
<host>host</host>
<database>database</database>
<username>username</username>
<password>password</password>
|
You also need to login to MySQL and create the MediaTomb database and user.
mysql> CREATE DATABASE database; mysql> GRANT ALL ON database.* TO 'username'@'host' IDENTIFIED BY 'password';
Transcoding Support
MediaTomb allows you to transcode unsupported media files to formats that are supported by your UPnP device. MediaTomb's transcoding support is very flexible and any application capable of transcoding can be used. The following configuration uses VLC to transcode FLAC, Flash, Theora and Vorbis files. Please consult the MediaTomb Transcoding documentation for more information.
Edit the Configuration File
To enable transcoding support open the MediaTomb configuration file and add the following section in between the </import> and </config> tags.
| File: /etc/mediatomb/config.xml |
<transcoding enabled="yes">
<mimetype-profile-mappings>
<transcode mimetype="application/ogg" using="audio-common"/>
<transcode mimetype="application/ogg" using="video-common"/>
<transcode mimetype="audio/x-flac" using="audio-common"/>
<transcode mimetype="video/x-flv" using="video-common"/>
</mimetype-profile-mappings>
<profiles>
<profile name="audio-common" enabled="yes" type="external">
<mimetype>audio/L16</mimetype>
<accept-url>yes</accept-url>
<first-resource>yes</first-resource>
<hide-original-resource>yes</hide-original-resource>
<accept-ogg-theora>no</accept-ogg-theora>
<agent command="mediatomb-transcode-audio" arguments="%in %out"/>
<buffer size="1048576" chunk-size="131072" fill-size="262144"/>
</profile>
<profile name="video-common" enabled="yes" type="external">
<mimetype>video/mpeg</mimetype>
<accept-url>yes</accept-url>
<first-resource>yes</first-resource>
<hide-original-resource>yes</hide-original-resource>
<accept-ogg-theora>yes</accept-ogg-theora>
<agent command="mediatomb-transcode-video" arguments="%in %out"/>
<buffer size="10485760" chunk-size="262144" fill-size="524288"/>
</profile>
</profiles>
</transcoding>
|
You also need to add the following section in between the <mimetype-profile-mappings> and </mimetype-profile-mappings> tags for every additional mimetype that requires transcoding.
| File: /etc/mediatomb/config.xml |
<transcode mimetype="mimetype" using="profile"/>
|
AVI FourCC Support
MediaTomb allows you to restrict AVI file transcoding to certain FourCC's. There are three FourCC configuration modes: disabled, process and ignore. The disabled mode will transcode all AVI files. The process mode will transcode AVI files that have their FourCC listed. The ignore mode will not transcode AVI files that have their FourCC listed. The following configuration will transcode all AVI files except those with the DX50 FourCC. Please consult Section 3.3 of the MediaTomb Transcoding documentation for more information.
To enable AVI FourCC support open the MediaTomb configuration file and add the following section in between the <profile name="video-common" enabled="yes" type="external"> and </profile> tags.
| File: /etc/mediatomb/config.xml |
<avi-fourcc-list mode="ignore">
<fourcc>DX50</fourcc>
</avi-fourcc-list>
|
Create the Transcoding Scripts
VLC Transcoding Scripts
The VLC audio transcoding script will produce a RAW formatted PCM audio stream, while the VLC video transcoding script will produce a PS formatted MPEG-2 video stream. You can adjust the output stream by modifying the relevant transcoding script variables. Please consult Chapter 3 of the VLC Streaming HOWTO for more information.
To enable VLC audio transcoding create the following audio transcoding script.
| File: /usr/bin/mediatomb-transcode-audio |
#!/bin/bash
VLC_PATH="/usr/bin/vlc"
INPUT="$1"
OUTPUT="$2"
AUDIO_CODEC="s16l"
AUDIO_BITRATE="192"
AUDIO_SAMPLERATE="44100"
AUDIO_CHANNELS="2"
FORMAT="raw"
exec "${VLC_PATH}" "${INPUT}" -I dummy --sout "#transcode{acodec=${AUDIO_CODEC},\
ab=${AUDIO_BITRATE},samplerate=${AUDIO_SAMPLERATE},channels=${AUDIO_CHANNELS}}:\
standard{mux=${FORMAT},access=file,dst=${OUTPUT}}" vlc:quit >/dev/null 2>&1
|
You also need to make the audio transcoding script executable.
# chmod +x /usr/bin/mediatomb-transcode-audio
To enable VLC video transcoding create the following video transcoding script.
| File: /usr/bin/mediatomb-transcode-video |
#!/bin/bash
VLC_PATH="/usr/bin/vlc"
INPUT="$1"
OUTPUT="$2"
VIDEO_CODEC="mp2v"
VIDEO_BITRATE="4096"
VIDEO_FRAMERATE="25"
AUDIO_CODEC="mpga"
AUDIO_BITRATE="192"
AUDIO_SAMPLERATE="44100"
AUDIO_CHANNELS="2"
FORMAT="ps"
SUBTITLE_LANGUAGE="eng"
exec "${VLC_PATH}" "${INPUT}" -I dummy --sout "#transcode{vcodec=${VIDEO_CODEC},\
vb=${VIDEO_BITRATE},fps=${VIDEO_FRAMERATE},acodec=${AUDIO_CODEC},ab=${AUDIO_BITRATE},\
samplerate=${AUDIO_SAMPLERATE},channels=${AUDIO_CHANNELS},soverlay,audio-sync}:\
standard{mux=${FORMAT},access=file,dst=${OUTPUT}}" --sub-language=${SUBTITLE_LANGUAGE} \
vlc:quit >/dev/null 2>&1
|
You also need to make the video transcoding script executable.
# chmod +x /usr/bin/mediatomb-transcode-video
FFmpeg Transcoding Scripts
The FFmpeg audio transcoding script will produce a RAW formatted PCM audio stream, while the FFmpeg video transcoding script will produce a PS formatted MPEG-2 video stream. You can adjust the output stream by modifying the relevant transcoding script variables. Please consult Section 3 of the FFmpeg documentation for more information.
To enable FFmpeg audio transcoding create the following audio transcoding script.
| File: /usr/bin/mediatomb-transcode-audio |
#!/bin/bash
FFMPEG_PATH="/usr/bin/ffmpeg"
INPUT="$1"
OUTPUT="$2"
AUDIO_CODEC="pcm_s16le"
AUDIO_BITRATE="192k"
AUDIO_SAMPLERATE="44100"
AUDIO_CHANNELS="2"
FORMAT="s16le"
exec "${FFMPEG_PATH}" -i "${INPUT}" -acodec ${AUDIO_CODEC} -ab ${AUDIO_BITRATE} \
-ar ${AUDIO_SAMPLERATE} -ac ${AUDIO_CHANNELS} -f ${FORMAT} - > "${OUTPUT}" 2>/dev/null
|
You also need to make the audio transcoding script executable.
# chmod +x /usr/bin/mediatomb-transcode-audio
To enable FFmpeg video transcoding create the following video transcoding script.
| File: /usr/bin/mediatomb-transcode-video |
#!/bin/bash
FFMPEG_PATH="/usr/bin/ffmpeg"
INPUT="$1"
OUTPUT="$2"
VIDEO_CODEC="mpeg2video"
VIDEO_BITRATE="4096k"
VIDEO_FRAMERATE="25"
AUDIO_CODEC="mp2"
AUDIO_BITRATE="192k"
AUDIO_SAMPLERATE="44100"
AUDIO_CHANNELS="2"
FORMAT="dvd"
exec "${FFMPEG_PATH}" -i "${INPUT}" -vcodec ${VIDEO_CODEC} -b ${VIDEO_BITRATE} \
-r ${VIDEO_FRAMERATE} -acodec ${AUDIO_CODEC} -ab ${AUDIO_BITRATE} -ar ${AUDIO_SAMPLERATE} \
-ac ${AUDIO_CHANNELS} -f ${FORMAT} - > "${OUTPUT}" 2>/dev/null
|
You also need to make the video transcoding script executable.
# chmod +x /usr/bin/mediatomb-transcode-video
Install the Transcoder
If you're using the VLC transcoding scripts:
# emerge vlc
If you're using the FFmpeg transcoding scripts:
# emerge ffmpeg
PlayStation 3 Support
To enable PlayStation 3 support open the MediaTomb configuration file and set the protocolInfo tag extend attribute to yes.
| File: /etc/mediatomb/config.xml |
<protocolInfo extend="yes"/>
|
PlayStation 3 DivX Support
To enable PlayStation 3 DivX support open the MediaTomb configuration file and add the following section in between the <extension-mimetype ignore-unknown="no"> and </extension-mimetype> tags.
| File: /etc/mediatomb/config.xml |
<map from="avi" to="video/divx"/>
<map from="divx" to="video/divx"/>
|
You also need to add the following section in between the <mimetype-contenttype> and </mimetype-contenttype> tags.
| File: /etc/mediatomb/config.xml |
<treat mimetype="video/divx" as="avi"/>
|
PlayStation 3 Thumbnail Support
To enable PlayStation 3 thumbnail support open the MediaTomb configuration file and change the <transcoding enabled="no"> to yes, then add the following section in between the <profiles> and </profiles> tags.
| File: /etc/mediatomb/config.xml |
<profile name="video-thumbnail" enabled="yes" type="external">
<mimetype>image/jpeg</mimetype>
<accept-url>yes</accept-url>
<thumbnail>yes</thumbnail>
<resolution>128x128</resolution>
<agent command="ffmpegthumbnailer" arguments="-i %in -o %out -s 128"/>
<buffer size="524288" chunk-size="512" fill-size="1024"/>
</profile>
|
You need to add the following section in between the <mimetype-profile-mappings> and </mimetype-profile-mappings> tags for every mimetype that requires thumbnails.
| File: /etc/mediatomb/config.xml |
<transcode mimetype="mimetype" using="video-thumbnail"/>
|
You also need to install FFmpeg Thumbnailer.
# emerge ffmpegthumbnailer
Starting
To start MediaTomb:
# /etc/init.d/mediatomb start
To start MediaTomb at boot:
# rc-update add mediatomb default
See Also
External Links
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should be using interactive floor plans and real estate agent tools.
