update mediatomb-0.12.1
CentOS6 編

実 験中です!

<< トップページへ

概要

rpmforgeのrpmではサムネイル対応にならなかったのでしょうがなく自分でビルドしました。(笑)それと、残念なのですがubuntuと  config.xml が共通ではありません。

実験の材料

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

$ rpm -qi lastfmlib
Name        : lastfmlib                    Relocations: (not relocatable)
Version     : 0.4.0                             Vendor: (none)
Release     : 2.el6                         Build Date: 2011年08月28日 15時57分24秒
Install Date: 2011年08月28日 15時57分36秒      Build Host: localhost.localdomain
Group       : System Environment/Libraries   Source RPM: lastfmlib-0.4.0-2.el6.src.rpm
Size        : 151445                           License: GPLv2+
Signature   : (none)
URL         : http://code.google.com/p/lastfmlib
Summary     : Last.fm scrobbling library
Description :
lastfmlib is library that provides an implementation of
the Last.fm Submissions Protocol v1.2. It allows you
to scrobble your tracks on Last.fm


ffmpegthumbnailer

http://code.google.com/p/ffmpegthumbnailer/downloads/
detail?name=ffmpegthumbnailer-2.0.6.tar.gz&can=2&q=

$ rpm -qi ffmpegthumbnailer
Name        : ffmpegthumbnailer            Relocations: (not relocatable)
Version     : 2.0.6                             Vendor: (none)
Release     : 2.el6                         Build Date: 2011年08月28日 15時56分27秒
Install Date: 2011年08月28日 15時56分39秒      Build Host: localhost.localdomain
Group       : Applications/Multimedia       Source RPM: ffmpegthumbnailer-2.0.6-2.el6.src.rpm
Size        : 194035                           License: GPLv2+
Signature   : (none)
URL         : http://code.google.com/p/ffmpegthumbnailer/
Summary     : Lightweight video thumbnailer that can be used by file managers
Description :
This video thumbnailer can be used to create thumbnails for your video files.


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

$ rpm -qi mediatomb
Name        : mediatomb                    Relocations: (not relocatable)
Version     : 0.12.2                            Vendor: (none)
Release     : 1.el6                         Build Date: 2011年09月11日 13時10分36秒
Install Date: 2011年09月11日 13時12分47秒      Build Host: kkuma-i5
Group       : Applications/Multimedia       Source RPM: mediatomb-0.12.2-1.el6.src.rpm
Size        : 2672233                          License: GPLv2
Signature   : (none)
URL         : http://mediatomb.cc
Summary     : MediaTomb - UPnP AV Mediaserver for Linux
Description :
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 listen to/watch it on a variety of UPnP compatible devices.

MediaTomb implements the UPnP MediaServer V 1.0 specification that can
be found on http://www.upnp.org/.

rpmを作成してインストールなのですが順番が大切?!

  # vi /etc/ld.so.conf

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

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

  ここで lastfmlib ffmpegthumbnailer rpmでインストールする

  mediatomb.spec編集

  $ tar xvzf mediatomb-0.12.1.tar.gz
  $ cd mediatomb-0.12.1

  $ vi
mediatomb.spec
   赤字部分を修正,追加する。
%define name mediatomb
%define version 0.12.2
%define release 1%{?dist}

Version: %{version}
Summary: MediaTomb - UPnP AV Mediaserver for Linux
Name: %{name}
Release: %{release}
License: GPLv2
Group: Applications/Multimedia
Source: http://downloads.sourceforge.net/mediatomb/%{name}-%{version}.tar.gz
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

ここで試しに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 は事前にインストールしておく事。)

$ cd ../
$ mv mediatomb-0.12.1  mediatomb-0.12.2
$ tar -zcvf mediatomb-0.12.2.tar.gz mediatomb-0.12.2
$ cp mediatomb-0.12.2.tar.gz /home/hoge/rpmbuild/SOURCES/
$ cd mediatomb-0.12.2
$ rpmbuild -bb ./mediatomb.spec
mediatonbのrpmを作成、インストールを行う。
# rpm -Uvh /home/hoge/rpmbuild/RPMS/x86_64/mediatomb-0.12.2-1.el6.x86_64.rpm

ffmpegthumbnailerのテスト方法
$ ffmpegthumbnailer -i test.ts -o out.jpg -t 1

これでサムネイルが作成されれば正常です。

     これでインストールは完了です。
     基本的な設定は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

<?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" 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-CentOS6</name>
    <udn>uuid:c04061cf-1d26-467c-9837-91961bb0eb93</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>
    </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"/>


        <!-- Uncomment the line below for PS3 divx support -->
        <!-- <map from="avi" to="video/divx"/> -->
        <!-- Uncomment the line below for D-Link DSM / ZyXEL DMA-1000 -->
        <!-- <map from="avi" to="video/avi"/> -->
      </extension-mimetype>
      <mimetype-upnpclass>
        <map from="audio/*" 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="audio/x-wav" as="pcm"/>
        <treat mimetype="audio/L16" as="pcm"/>
        <treat mimetype="video/x-msvideo" as="avi"/>
        <treat mimetype="video/mp4" as="mp4"/>
        <treat mimetype="audio/mp4" as="mp4"/>
        <treat mimetype="application/x-iso9660" as="dvd"/>
        <treat mimetype="application/x-iso9660-image" as="dvd"/>
      </mimetype-contenttype>
    </mappings>
    <online-content>
      <YouTube enabled="no" refresh="28800" update-at-start="no" purge-after="604800" racy-content="exclude" format="mp4" hd="no">
        <favorites user="mediatomb"/>
        <standardfeed feed="most_viewed" time-range="today"/>
        <playlists user="mediatomb"/>
        <uploads user="mediatomb"/>
        <standardfeed feed="recently_featured" time-range="today"/>
      </YouTube>
    </online-content>
  </import>
  <transcoding enabled="no">
    <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="no" 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のテストをしてみてください。