update mediatomb-0.12.1

実 験中です!

<< トップページへ

概要

久しぶりのアップデートです。念願のサムネイル対応となっています。その他機能も追加になっていますが検証中(笑)です。

実験の材料

lastfmlib
http://lastfmlib.googlecode.com/files/lastfmlib-0.4.0.tar.gz

ffmpegthumbnailer

http://ffmpegthumbnailer.googlecode.com/files/ffmpegthumbnailer-2.0.1.tar.gz

mediatomb
http://sourceforge.jp/projects/sfnet_mediatomb/releases/?file_id=2541902

rpmを作成してインストール

mediatomb.spec編集
    $ tar xvzf mediatomb-0.12.1.tar.gz
    $ cd mediatomb-0.12.1

    $ vi
mediatomb.spec
    赤字部分を修正,追加する。

URL: http://mediatomb.cc
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: sqlite-devel, mysql-devel, libexif-devel, taglib-devel, file, js-devel, zlib-devel, expat-devel
Requires: mysql
Requires(pre): shadow-utils

# vi /etc/ld.so.conf

include ld.so.conf.d/*.conf
/usr/local/lib
/usr/lib

追加後に実行する。
# /sbin/ldconfig

ここで試しにconfigureしてみる。

$ ./configure

sqlite3               : yes
mysql                 : yes
libjs                 : yes
libmagic              : yes
inotify               : yes
libexif               : yes
id3lib                : disabled
taglib                : yes
libmp4v2              : yes
ffmpeg                : yes
ffmpegthumbnailer     : yes
lastfmlib             : yes
external transcoding  : yes
curl                  : yes
YouTube               : yes
libextractor          : disabled
db-autocreate         : yes

こんな感じでOKです。(lastfmlib ffmpegthumbnailer は事前にインストールしておく事。)

ffmpegthumbnailerのテスト方法
$ ffmpegthumbnailer -i test.ts -o out.jpg -t 1
これでサムネイルが作成されれば正常です。

mediatonbのrpmを作成、インストールを行う。

# cp mediatomb-0.12.1.tar.gz /usr/src/redhat/SOURCES/
# cp mediatomb.spec /usr/src/redhat/SPECS/
# cd /usr/src/redhat/SPECS/
# rpmbuild -bb mediatomb.spec
#rpm -Uvh /usr/src/redhat/RPMS/i386/mediatomb-0.12.1-1.i386.rpm

    これでインストールは完了です。
    基本的な設定はmediatomb-0.11.0と同じで問題ありません。

設定-1 mysql

  本格的にmediatombを使うためにmysqlのデーターベースで動作するように
  mysqlのデーターベースを作成しました。
  データベースとlocalhostからのみ接続できる"mediatomb"という
  パスワードなしの名前のユーザを作成できます。
 
  参考リンク:http://www.impressit.co.jp/blog/dev/?p=5Link

$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or ¥g.Your MySQL connection id is 36 to server version: 5.0.22Type 'help;' or '¥h' for help. Type '¥c' to clear the buffer. 
mysql> CREATE DATABASE mediatomb;
Query OK, 1 row affected (0.00 sec) 
mysql> GRANT ALL ON mediatomb.* TO 'mediatomb'@'localhost';
Query OK, 0 rows affected (0.05 sec) 
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec) 
mysql> quit;Bye

# /etc/init.d/mysqld restart

設定-2  /etc/mediatomb.conf

# vi /etc/mediatomb.conf

## This is a sambel configuration file for the MediaTomb daemon script
## used on Fedora Core

## By default the configuration will be created in /etc/mediatomb

## Network interface on which the server will run, you need to edit this!
#MT_INTERFACE="NOT_SET"
MT_INTERFACE="eth0"

## User defined command line options that may be passed to the server
MT_OPTIONS=""

## MediaTomb will be started on port 50500
MT_PORT="50500"

## MediaTomb will run as nobody
MT_USER="nobody"
MT_GROUP="nobody"

## Location of the PID file
MT_PIDFILE="/var/run/mediatomb.pid"

## Location of the log file
MT_LOGFILE="/var/log/mediatomb"

## Location of the config file/database
MT_HOME="/etc"
MT_CFGDIR="mediatomb"


/etc/mediatomb/config.xmlの設定


設定-3  /etc/mediatomb/config.xml

$ cat /etc/mediatomb/config.xml $ cat /etc/mediatomb/config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config version="2" xmlns="http://mediatomb.cc/config/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"RESTART-mysql xsi:schemaLocation="http://mediatomb.cc/config/2 http://mediatomb.cc/config/2.xsd">
  <server>
    <ui enabled="yes" show-tooltips="yes">
      <accounts enabled="no" session-timeout="30">
        <account user="mediatomb" password="mediatomb"/>
      </accounts>
    </ui>
    <name>MediaTomb</name>
    <udn>uuid:705d95a7-5ecc-558e-4e39-f55555a5c5f1tlt;/udn>
    <home>/etc/mediatomb</home>
    <webroot>/usr/share/mediatomb/web</webroot>
    <storage>
      <sqlite3 enabled="no">
        <database-file>mediatomb.db</database-file>
      </sqlite3>
      <mysql enabled="yes">
        <host>localhost</host>
        <username>mediatomb</username>
        <database>mediatomb</database>
      </mysql>
    </storage>
    <protocolInfo extend="yes"/><!-- For PS3 support change to "yes" -->
    <!--
       Uncomment the lines below to get rid of jerky avi playback on the
       DSM320 or to enable subtitles support on the DSM units
    -->
    <!--
    <custom-http-headers>
      <add header="X-User-Agent: redsonic"/>
    </custom-http-headers>

    <manufacturerURL>redsonic.com</manufacturerURL>
    <modelNumber>105</modelNumber>
    -->
    <!-- Uncomment the line below if you have a Telegent TG100 -->
    <!--
       <upnp-string-limit>101</upnp-string-limit>
    -->
    <extended-runtime-options>
      <ffmpegthumbnailer enabled="yes">
        <thumbnail-size>128</thumbnail-size>
        <seek-percentage>5</seek-percentage>
        <filmstrip-overlay>yes</filmstrip-overlay>
        <workaround-bugs>no</workaround-bugs>
        <image-quality>8</image-quality>
      </ffmpegthumbnailer>
      <mark-played-items enabled="no" suppress-cds-updates="yes">
        <string mode="prepend">*</string>
        <mark>
          <content>video</content>
        </mark>
      </mark-played-items>
      <lastfm enabled="no">
        <username>lastfmuser</username>
        <password>lastfmpass</password>
      </lastfm>
    </extended-runtime-options>
  </server>
  <import hidden-files="no">
    <scripting script-charset="UTF-8">
      <common-script>/usr/share/mediatomb/js/common.js</common-script>
      <playlist-script>/usr/share/mediatomb/js/playlists.js</playlist-script>
      <virtual-layout type="builtin">
        <import-script>/usr/share/mediatomb/js/import.js</import-script>
      </virtual-layout>
    </scripting>
    <mappings>
      <extension-mimetype ignore-unknown="no">
        <map from="jpg" to="image/jpeg"/>
        <map from="jpeg" to="image/jpeg"/>
        <map from="gif" to="image/gif"/>
        <map from="png" to="image/png"/>
        <map from="m4v" to="video/mp4"/>
        <map from="mp4" to="video/mp4"/>
        <map from="mpg" to="video/mpeg"/>
        <map from="mpeg" to="video/mpeg"/>
        <map from="ts" to="video/vnd.dlna.mpeg-tts"/>
        <map from="m2ts" to="video/mpeg"/>
        <map from="divx" to="video/divx"/>
        <map from="avi" to="video/avi"/>
        <map from="mp3" to="audio/mpeg"/>
        <map from="ogg" to="application/ogg"/>
        <map from="asf" to="video/x-ms-asf"/>
        <map from="asx" to="video/x-ms-asf"/>
        <map from="wma" to="audio/x-ms-wma"/>
        <map from="wax" to="audio/x-ms-wax"/>
        <map from="wmv" to="video/x-ms-wmv"/>
        <map from="wvx" to="video/x-ms-wvx"/>
        <map from="wm" to="video/x-ms-wm"/>
        <map from="wmx" to="video/x-ms-wmx"/>
        <map from="m3u" to="audio/x-mpegurl"/>
        <map from="pls" to="audio/x-scpls"/>
        <map from="iso" to="application/x-iso9660"/>
      </extension-mimetype>
      <mimetype-upnpclass>
        <map from="audio/*" to="object.item.audioItem.musicTrack"/>
        <map from="application/ogg" to="object.item.audioItem.musicTrack"/>
        <map from="video/*" to="object.item.videoItem"/>
        <map from="image/*" to="object.item.imageItem"/>
      </mimetype-upnpclass>
      <mimetype-contenttype>
        <treat mimetype="audio/mpeg" as="mp3"/>
        <treat mimetype="application/ogg" as="ogg"/>
        <treat mimetype="audio/x-flac" as="flac"/>
        <treat mimetype="image/jpeg" as="jpg"/>
        <treat mimetype="audio/x-mpegurl" as="playlist"/>
        <treat mimetype="audio/x-scpls" as="playlist"/>
        <treat mimetype="video/x-msvideo" as="avi"/>
        <treat mimetype="application/x-iso9660" as="dvd"/>
      </mimetype-contenttype>
    </mappings>
    <online-content>
      <!-- Make sure to setup a transcoding profile for flv -->
      <YouTube enabled="yes" refresh="28800" update-at-start="yes" purge-after="604800" racy-content="exclude">
        <standardfeed feed="most_viewed" time-range="today"/>
<!--
        <favorites user="mediatomb"/>
        <playlists user="mediatomb"/>
        <uploads user="mediatomb"/>
-->
        <standardfeed feed="recently_featured" time-range="today"/>
      </YouTube>
    </online-content>
  </import>
  <transcoding enabled="yes">
    <mimetype-profile-mappings>
      <transcode mimetype="video/x-flv" using="vlcmpeg"/>
      <transcode mimetype="application/ogg" using="vlcmpeg"/>
      <transcode mimetype="application/ogg" using="oggflac2raw"/>
      <transcode mimetype="audio/x-flac" using="oggflac2raw"/>
    </mimetype-profile-mappings>
    <profiles>
      <profile name="oggflac2raw" enabled="no" type="external">
        <mimetype>audio/L16</mimetype>
        <accept-url>no</accept-url>
        <first-resource>yes</first-resource>
        <accept-ogg-theora>no</accept-ogg-theora>
        <agent command="ogg123" arguments="-d raw -o byteorder:big -f %out %in"/>
        <buffer size="1048576" chunk-size="131072" fill-size="262144"/>
      </profile>
      <profile name="vlcmpeg" enabled="yes" type="external">
        <mimetype>video/mpeg</mimetype>
        <accept-url>yes</accept-url>
        <first-resource>yes</first-resource>
        <accept-ogg-theora>yes</accept-ogg-theora>
        <agent command="vlc" arguments="-I dummy %in --sout #transcode{venc=ffmpeg,vcodec=mp2v,vb=4096,fps=25,
aenc=ffmpeg,acodec=mpga,ab=192,samplerate=44100,channels=2}:
standard{access=file,mux=ps,dst=%out} vlc:quit"/>
        <buffer size="14400000" chunk-size="512000" fill-size="120000"/>
      </profile>
    </profiles>
  </transcoding>
</config>

動作確認

   # /etc/init.d/mediatomb restart

   再起動してPS3でいつものホルダーにアクセスいてみると...

   うまくいかない時はffmpegthumbnailerのテストをしてみてください。
  私の場合はなぜかデーターベースを再作成しないとだめでした。