« 謹賀新年 | Main | ながら動画:Remedie »


2009.01.04

PS3+Macで超・超快適メディアプレイヤー:Youtube->Mediatomb on iMac ->PS3 ->BRAVIA

去年、drikinから教えてもらった「PS3 + Mac(MediaTomb)でAppleTVいらずの超快適メディアプレイヤー」。

私の環境ではどうもうまくいかず放っていたのだが、年末年始のお休みで時間があったのでXCODEを再インストールしたら、あっけなく動いてしまった。最新版Mediatomb(メディアトゥーム)12.0.0ではオンラインのYoutubeの視聴が可能だというので、最新版を入手してPS3経由でYoutubeとかAppleTrailersをTV(BRAVIA)で閲覧できるようにしてみた。これは、さらにいい感じ、超快適。世界が変わる感じ。

PS3+Macこれは最強かも。



以下、手順。

まず、最新版のソースコードを入手する。ターミナルからsvnコマンドでCheckOut。(Xcodeはあらかじめシステムディスク等からインストールしておくこと。)

svn co https://svn.mediatomb.cc/svnroot/mediatomb/trunk/mediatomb mediatomb0.12.0

(R)eject, accept (t)emporarily or accept (p)ermanently? と聞かれたら t(またはp) を押す。

コードが入手できたら、インストール作業。

        cd mediatomb0.12.0
sudo autoreconf -i
./configure
sudo make
sudo make install

これで、インストール終了。簡単! この状態でいったん起動してみる。

        mediatomb -i x.x.x.x

x.x.x.xには192.168.0.9とかMediatombが起動するMacのIPアドレスが入る。

うまくいけばINFOメッセージの最後にINFO: http://192.168.0.9:49152/のようなメッセージがあらわれるはず…。

最初の起動で必要なファイルができあがるので、まずはPS3とMac用に設定ファイルを編集する。設定ファイルはユーザのホームの不可視のディレクトリ~./mediatomb にある/Users/hoge/.mediatomb/config.xmlこれをPS3+Mac用に編集する。

こちらを参考にhttp://blog.drikin.com/2008/10/ps3-macmediatom.html

一回目の起動時に、~/.mediatomb/config.xmlという設定ファイルが作成されるので、これをviなどで開いて、PS3とMac用の設定をしてください。具体的にはPS3ではコメントアウトしてねって所の変更と、Macでの日本語文字化け対策で、数行修正するだけ。
18行目あたり <protocolInfo extend="yes"/><!-- For PS3 support change to "yes" -->
36行目あたり
<import hidden-files="no">
<filesystem-charset>UTF-8-MAC</filesystem-charset>
<metadata-charset>UTF-8-MAC</metadata-charset>

58行目あたり <map from="avi" to="video/divx"/>

これで、通常のファイルはPS3で閲覧可能になったはず。
さて、ここから本題のYoutubeの導入。
5行目あたりの<account user= に youtubeのアカウントユーザ名とパスワードを記入したあと、
<account user="hogehoge" password="xxxxxxx"/>
90行あたりの <YouTube enabled="no"……の部分をお好みで書き変える。
こんな感じ。

<online-content>
<YouTube enabled="yes" refresh="28800" update-at-start="yes" purge-after="604800" racy-content="exclude" format="flv" hd="yes">
<YouTube enabled="yes" refresh="28800" update-at-start="yes" purge-after="604800" racy-content="exclude" format="flv" hd="yes">
<favorites user="ユーザのIDをいれる"/>
<standardfeed feed="most_viewed" time-range="today" region-id="jp"/>
<playlists user="ユーザのIDをいれる"/>
<uploads user="ユーザのIDをいれる"/>
<standardfeed feed="recently_featured" time-range="today"region-id="jp"/>
</YouTube>

次にflvを変換してPS3で読める形に変換するための設定を行う。
100行目付近
<transcoding enabled="no">を <transcoding enabled="yes">にする。

さらに変換する対象と変換に使用するアプリケーションを<mimetype-profile-mappings>内に記述する。

<mimetype-profile-mappings>

<transcode mimetype="video/x-flv" using="vlcvideo"/>

変換するアプリケーションだが、ffmpegとかをインストールは面倒なので、コマンドラインも用意されているマカー御用達VLCをつかった。ただし、VLCは、0.9以降で soutの記述が変わってしまい、shを書かないと動かなさそうなので、0.86iを使うことにした。

Note: If you are running VLC on Mac OS X, you should use clivlc instead of VLC to avoid possible Bus error problems.
(http://wiki.videolan.org/Transcode)
ということで、シンボリックリンクをVLCに張ったclivlcを使う。(0.86のパッケージ内に用意されている)こうしておくと、ドックにVLCアイコンが現れることもない。

要はこんな感じに110行目付近の<profiles></profiles>の中を書き変える。

<profiles>
<profile name="vlcvideo" 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="/Applications/vlc-086i/VLC.app/Contents/MacOS/clivlc" 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} /Applications/vlc-086i/VLC.app/Contents/MacOS/clivlc:quit"/>
<buffer size="14400000" chunk-size="512000" fill-size="120000"/>
</profile>
</profiles>

「/Applications/VLC.app/Contents/MacOS/clivlc:quit」の部分は、VLC.appのパッケージの中身(ctr+クリックで「パッケージの内容を表示」で見ることができる。)にあるclivlc(VLCへのシンボリックリンク)へのPath。他の数値とかも環境によって最適ではないので、要注意。

Youtubeとあわせて、AppleTrailers も enableに設定しておく。
<AppleTrailers enabled="yes" refresh="43200" update-at-start="yes" resolution="720p"/>
(720pのところは640でも可、TV画面に応じて変更すること)
QTのトランスコードもVLCで行うことにして
<mimetype-profile-mappings>の中に
<transcode mimetype="video/x-quicktime" using="vlcvideo"/>
<transcode mimetype="video/quicktime" using="vlcvideo"/>
も付け加えておく。(これでQTムービーも表示可能に)

修正後、再度mediatombを起動すると、冒頭の動画のようにPS3からオンラインのYoutubeが視聴できるはず。

どうもうちの環境では高画質モードが、うまく表示できない。このあたりの設定とかにはもう少し工夫がいるのかもしれない。

AppleTrailersの方は、これは驚くほど、美しく表示できている。

すばらしい。いずれにせよ、まだ正式版がでていないので、そこはユーザの自己責任ということで…お願いします。

家電?(Mac+PS3+TV)の連携とか、プラガブルに機能(ハード、ソフト )をつぎあわせて、ユーザが目的を達成する。なんとなく、次に起ることを予感させる‥ような…。remedie(cf. otsuneさんのまとめ)とか、coRocketsとか様々、次を予感させるもの、こと、が今年は、でてきそう。楽しみ。

【追記1】

drikinより、format="flv" をformat="mp4"に

<YouTube enabled="yes" refresh="28800" update-at-start="yes" purge-after="604800" racy-content="exclude" format="mp4" hd="yes">

さらに

<mimetype-profile-mappings>内に<transcode mimetype="video/mp4" using="vlcvideo"/>

を追加、mp4をトランスコードする形で、見事、高画質のコンテンツも美しく再生できることを教わった。これで完璧。(下記のconfigも変更しておいた。ただし、この設定にするとネットワーク速度の影響を強く受けるので要注意。)

尚、http://juliensimon.blogspot.com/2008/12/mediatomb-012-on-ps3-video-thumbnails.html に記事中の追記で<protocolInfo extend="yes"/>の設定に関して書かれていて、PS3の最新ファーム(2.53以降)ではYesの設定は必要ないようだ。なんらか問題があれば外してみればよいとのこと。(ただし、="no"だと、サムネイルが表示されないので、ちと寂しくなる…w)

【追記2】
Remediaのリンク先を本家に変更。(Thanx! としのりさん)
それにしても、こうやって書くとエライたいへんな作業のようだけど、やりはじめると、それほどでもなかった印象(書き方の問題か…w)。PS3とMacな方は是非、お試しください。

参照
http://mediatomb.cc/dokuwiki/transcoding:transcoding

http://juliensimon.blogspot.com/2008/12/mediatomb-012-on-ps3-video-thumbnails.html

http://www.okubo.tk/blog/2008/11/21/007020.shtml

あくまで参考に私のconfig.xmlも貼っておきます。

<?xml version="1.0" encoding="UTF-8"?>
<config version="1" xmlns="http://mediatomb.cc/config/1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mediatomb.cc/config/1
http://mediatomb.cc/config/1.xsd">
<server>
<ui enabled="yes" show-tooltips="yes">
<accounts enabled="no" session-timeout="30">
<account user="hogehoge" password="***********************"/>
</accounts>
</ui>
<name>MediaTomb</name>
<udn>uuid:************************************************</udn>
<home>/Users/hoge/.mediatomb</home>
<webroot>/usr/local/share/mediatomb/web</webroot>
<storage>
<sqlite3 enabled="yes">
<database-file>mediatomb.db</database-file>
</sqlite3>
</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>
<mark-played-items enabled="no" suppress-cds-updates="yes">
<string mode="prepend">*</string>
</mark-played-items>
</extended-runtime-options>
</server>
<import hidden-files="no">
<filesystem-charset>UTF-8-MAC</filesystem-charset>
<metadata-charset>UTF-8-MAC</metadata-charset>
<scripting script-charset="UTF-8">
<virtual-layout type="builtin"/>
</scripting>
<mappings>
<extension-mimetype ignore-unknown="no">
<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="flv" to="video/x-flv"/>
<map from="avi" to="video/divx"/>

<!-- 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>
<!-- Make sure to setup a transcoding profile for flv -->
<YouTube enabled="yes" refresh="28800" update-at-start="yes"
purge-after="604800" racy-content="exclude" format="mp4" hd="yes">
<favorites user="hoge"/>
<standardfeed feed="most_viewed" time-range="today" region-id="jp"/>
<playlists user="hoge"/>
<uploads user="hoge"/>
<standardfeed feed="recently_featured" time-range="today"
region-id="jp"/>
</YouTube>
<AppleTrailers enabled="yes" refresh="43200" update-at-start="yes"
resolution="720p"/>
</online-content>
</import>
<transcoding enabled="yes">
<mimetype-profile-mappings>
<transcode mimetype="application/ogg" using="vlcwav"/>
<transcode mimetype="audio/x-flac" using="vlcwav"/>
<transcode mimetype="video/x-flv" using="vlcvideo"/>
<transcode mimetype="application/ogg" using="vlcvideo"/>
<transcode mimetype="video/x-quicktime" using="vlcvideo"/>
<transcode mimetype="video/quicktime" using="vlcvideo"/>
<transcode mimetype="video/mp4" using="vlcvideo"/>
</mimetype-profile-mappings>
<profiles>

<profile name="vlcwav" enabled="yes" type="external">
<use-chunked-encoding>no</use-chunked-encoding>
<mimetype>audio/wav</mimetype>
<accept-url>yes</accept-url>
<first-resource>yes</first-resource>
<agent command="/Applications/VLC.app/Contents/MacOS/clivlc"
arguments="-I dummy %in --sout #transcode{acodec=s16l,ab=192,channels=2}
:standard{access=file,mux=wav,dst=%out} /Applications/VLC.app/
Contents/MacOS/clivlc:quit"/>
<buffer size="1048576" chunk-size="131072" fill-size="262144"/>
</profile>

<profile name="vlcvideo" 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="/Applications/VLC.app/Contents/MacOS/clivlc"
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} /Applications/VLC.app/Contents/
MacOS/clivlc:quit"/>
<buffer size="14400000" chunk-size="512000" fill-size="120000"/>
</profile>

</profiles>
</transcoding>
</config>

Recent Trackbacks