- improved on-the-fly transcoding.
- built-in support for video thumbnails (using ffmpegthumbnailer),
- Apple movie trailers,
- YouTube video feeds
FYI, I'm using Ubuntu 8.04, ffmpeg SVN-r16245 (built from source), ffmpegthumbnailer 1.3.0 (built from source) and x264 0.65.1057 (built from source).
1) Basic configuration
mediatomb only has one config file, located in ~/.mediatomb/config.xml. For more information, please check the mediatomb documentation.
Let's start from the default settings and add a few things.
In the <server> section, set the extended UPnP protocol information for the PS3:
<protocolInfo extend="yes"/>[Updated on 2009/01/02] Reportedly not needed anymore if you're running the latest PS3 firmware (2.53). Try changing it to 'no' if you're experiencing issues with movie playback.
In the <extension-mimetype> section, add a few entries to map common extensions for video files to the appropriate MIME type:
<map from="avi" to="video/divx"/>In the <mimetype-contenttype> section, add a few entries to map MIME types to extensions, so that mediatomb can use the proper method to extract metadata:
<map from="mkv" to="video/x-matroska"/>
<map from="mts" to="video/mpeg"/>
<map from="ts" to="video/mpeg"/>
<map from="m2ts" to="video/mpeg"/>
<map from="mov" to="video/x-quicktime"/>
<map from="vob" to="video/mpeg"/>
<map from="m4v" to="video/mp4"/>
<treat mimetype="video/quicktime" as="mov"/>2) On-the-fly transcoding
<treat mimetype="video/x-quicktime" as="mov"/>
The PS3 supports a limited set of audio & video file formats. For example, it can't play FLAC, FLV, Quicktime, etc. In order to play these files anyway, we need mediatomb to transcode them on the fly and then stream them to the PS3 in a format it can play. Transcoding itself is performed by external tools, such as VLC and ffmpeg.
All we have to do is:
- list all MIME types which require transcoding,
- associate each of them to a transcoding profile,
- define the actual transcoding profiles.
- for audio transcoding (OGG and FLAC), a profile based on ffmpeg, which outputs 16-bit PCM stereo audio at 44.1KHz and 192 Kbit/s,
- for video transcoding (ASF, FLV, Quicktime), a profile also based on ffmpeg, which outputs MPEG-2 video at 25 fps and 4Mbit/s, as well as MPEG stereo audio at at 44.1KHz and 192 Kbit/s.
<transcoding enabled="yes">Now, here's the 'mediatomb-video-generic' script. Don't forget to change the path to ffmpeg if needed and to set execute rights ('chmod 755 /usr/local/bin/mediatomb-video-generic'):
<mimetype-profile-mappings>
<transcode mimetype="application/ogg" using="audio-generic"/>
<transcode mimetype="audio/x-flac" using="audio-generic"/>
<transcode mimetype="video/x-ms-asf" using="video-generic"/>
<transcode mimetype="video/x-flv" using="video-generic"/>
<transcode mimetype="video/x-matroska" using="video-generic"/>
<transcode mimetype="video/x-quicktime" using="video-generic"/>
<transcode mimetype="video/quicktime" using="video-generic"/>
</mimetype-profile-mappings>
<profiles>
<profile name="audio-generic" enabled="yes" type="external" >
<mimetype>audio/L16</mimetype>
<first-resource>yes</first-resource>
<accept-url>yes</accept-url>
<sample-frequency>44100</sample-frequency>
<audio-channels>2</audio-channels>
<hide-original-resource>yes</hide-original-resource>
<agent command="ffmpeg" arguments="-ac 2 -ar 44100 -y -i %in -f s16be %out"/>
<buffer size="1048576" chunk-size="4096" fill-size="1024"/>
</profile>
<profile name="video-generic" enabled="yes" type="external">
<avi-fourcc-list mode="ignore">
<fourcc>DX50</fourcc>
<fourcc>DM4V</fourcc>
<fourcc>M4S2</fourcc>
</avi-fourcc-list>
<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="/usr/local/bin/mediatomb-video-generic" arguments="%in %out"/>
<buffer size="1048576" chunk-size="26214" fill-size="52428"/>
</profile>
</profiles>
</transcoding>
[this updated script works for Youtube, Apple trailers and mkv files and doesn't require VLC anymore : thanks to the anonymous reader who contributed it].
#!/bin/bashAll right, let's get to the good stuff.
INPUT="$1"
OUTPUT="$2"
VIDEO_CODEC="mpeg2video"
VIDEO_BITRATE="4096k"
AUDIO_CODEC="mp2"
AUDIO_BITRATE="192k"
AUDIO_SAMPLERATE="48000"
AUDIO_CHANNELS="2"
FORMAT="dvd"
exec /usr/local/bin/ffmpeg -threads 2 -i "${INPUT}" -vcodec ${VIDEO_CODEC} -b ${VIDEO_BITRATE} \
-acodec ${AUDIO_CODEC} -ab ${AUDIO_BITRATE} -ar ${AUDIO_SAMPLERATE} -ac ${AUDIO_CHANNELS} \
-f ${FORMAT} - > "${OUTPUT}" 2>/dev/null
3) Video thumbnails
Assuming you have installed ffmpegthumbnailer, enabling on-the-fly thumbnail generation only requires this addition to the <server> section:
<extended-runtime-options>Let's save these changes, restart mediatomb and browse some videos: MPEG-2 on the left, DivX on the right. Thumbnails are generated on the fly when videos are browsed.
<ffmpegthumbnailer enabled="yes">
<thumbnail-size>128</thumbnail-size>
<seek-percentage>5</seek-percentage>
<filmstrip-overlay>yes</filmstrip-overlay>
<workaround-bugs>no</workaround-bugs>
</ffmpegthumbnailer>
</extended-runtime-options>
Let's try some different file types.
- Below on the left: VOB files ripped from a DVD. VOB files really are MPEG-2 files, but since they have a different extension, they wouldn't be viewable if we hadn't mapped the .vob extension to the video/mpeg MIME type.
- Below on the right: some MKV (Matroska) samples.
This looks much nicer than blank icons :)
4) Apple movie trailers
This feature, found in the Online Services menu, allows you to view movies trailers hosted on an Apple website.
This is very easy to configure. In the <online-content> section, add:
<AppleTrailers enabled="yes" refresh="43200" update-at-start="yes" resolution="640"/>Save the changes, restart mediatomb and...
It works like this. First, mediatomb fetches an RSS feed, then it parses it and dynamically creates menus where trailers are sorted by genre, release date, etc. Let's go to action movies and hmmm... 2012? What is this?
Wow, the Himalaya overrun by a giant wave, the end of the world, etc. My kind of movie :)
5) YouTube videos
Now, let's go back to the Online Services and enter the YouTube menu. In the mediatomb configuration file, we need to define:
- a valid YouTube account (username and password),
- the list of video feeds that we'd like to browse.
<account user="your_YouTube_username" password="your_YouTube_password"/>And in the <online-content> section, add:
<YouTube enabled="yes" refresh="28800" update-at-start="yes" purge-after="604800" racy-content="exclude">This is quite customizable, but no official documentation is out yet. A quick look at the code will give you some pointers, though ;)
<favorites user="your_YouTube_username"/>
<playlists user="your_YouTube_username"/>
<uploads user="your_YouTube_username"/>
<standardfeed feed="most_viewed" time-range="today"/>
<standardfeed feed="top_rated" time-range="this_week"/>
</YouTube>
Save the changes, restart mediatomb and now you can browse your YouTube playlists.
You can also browse the standard YouTube feeds that you have defined: Most Viewed, Top Rated, etc.
All right, that's it for today. Mediatomb is a GREAT project, I can't wait for the official release. In the meantime, there's already plenty to explore.
And by the way, Merry Christmas to all you geeks out there ;)
===================================
As requested, here's my config.xml file. You just change to change YouTube_Username, YouTube_Password, LastFM_Username & LastFM password to your own values.
<?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="YouTube_Username" password="YouTube_Password"/>
</accounts>
</ui>
<name>MediaTomb</name>
<udn>uuid:b8b13d59-378e-4cb8-9a87-14f70c70f847</udn>
<home>/home/julien/.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" -->
<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>
</ffmpegthumbnailer>
<mark-played-items enabled="no" suppress-cds-updates="yes">
<string mode="prepend">*</string>
</mark-played-items>
</extended-runtime-options>
</server>
<import hidden-files="no">
<scripting script-charset="UTF-8">
<common-script>/usr/local/share/mediatomb/js/common.js</common-script>
<playlist-script>/usr/local/share/mediatomb/js/playlists.js</playlist-script>
<virtual-layout type="builtin">
<import-script>/usr/local/share/mediatomb/js/import.js</import-script>
<dvd-script>/usr/local/share/mediatomb/js/import-dvd.js</dvd-script>
</virtual-layout>
</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"/>
<map from="mkv" to="video/x-matroska"/>
<map from="mts" to="video/mpeg"/>
<map from="ts" to="video/mpeg"/>
<map from="m2ts" to="video/mpeg"/>
<map from="flac" to="audio/x-flac"/>
<map from="mov" to="video/x-quicktime"/>
<map from="vob" to="video/mpeg"/>
<map from="m4v" to="video/mp4"/>
<map from="iso" to="application/x-iso9660-image"/>
</extension-mimetype>
<mimetype-upnpclass>
<map from="audio/*" to="object.item.audioItem.musicTrack"/>
<map from="video/*" to="object.item.videoItem"/>
<map from="application/x-iso9660-image" 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="video/x-msvideo" as="avi"/>
<treat mimetype="video/divx" as="avi"/>
<treat mimetype="video/mp4" as="mp4"/>
<treat mimetype="audio/mp4" as="mp4"/>
<treat mimetype="video/quicktime" as="mov"/>
<treat mimetype="video/x-quicktime" as="mov"/>
<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">
<favorites user="YouTube_Username"/>
<playlists user="YouTube_Username"/>
<uploads user="YouTube_Username"/>
<standardfeed feed="most_viewed" time-range="today"/>
<standardfeed feed="top_rated" time-range="this_week"/>
</YouTube>
<AppleTrailers enabled="yes" refresh="43200" update-at-start="yes" resolution="640"/>
</online-content>
</import>
<transcoding enabled="yes">
<mimetype-profile-mappings>
<transcode mimetype="application/ogg" using="audio-generic"/>
<transcode mimetype="audio/x-flac" using="audio-generic"/>
<transcode mimetype="video/x-ms-asf" using="video-generic"/>
<transcode mimetype="video/x-flv" using="video-generic"/>
<transcode mimetype="video/x-matroska" using="video-generic"/>
<transcode mimetype="video/x-quicktime" using="video-generic"/>
<transcode mimetype="video/quicktime" using="video-generic"/>
</mimetype-profile-mappings>
<profiles>
<profile name="audio-generic" enabled="yes" type="external" >
<mimetype>audio/L16</mimetype>
<first-resource>yes</first-resource>
<accept-url>yes</accept-url>
<sample-frequency>44100</sample-frequency>
<audio-channels>2</audio-channels>
<hide-original-resource>yes</hide-original-resource>
<agent command="ffmpeg" arguments="-ac 2 -ar 44100 -y -i %in -f s16be %out"/>
<buffer size="1048576" chunk-size="4096" fill-size="1024"/>
</profile>
<profile name="video-generic" enabled="yes" type="external">
<avi-fourcc-list mode="ignore">
<fourcc>DX50</fourcc>
<fourcc>DM4V</fourcc>
<fourcc>M4S2</fourcc>
</avi-fourcc-list>
<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="/usr/local/bin/mediatomb-video-generic" arguments="%in %out"/>
<buffer size="1048576" chunk-size="26214" fill-size="52428"/>
</profile>
</profiles>
</transcoding>
<lastfm enabled="yes">
<username>LastFM_Username</username>
<password>LastFM_Password</password>
</lastfm>
</config>
Great stuff, thanks for all the info, only a slight problem playing .flv files the audio is very fast and out of sync, any ideas?
ReplyDeleteYes, I have that problem too :) I'm trying to figure out whether this is a mediatomb issue or a transcoding issue.
ReplyDeleteI've tried other parameters for the transcoding profile, but to no avail... I'll update the post when I find a solution :)
Cool, this is one of the few things letting the PS3 down as an all in one media box, although at the moment I'm losing big chunks of my life to Fallout 3 :)
ReplyDeleteHope you can find a fix
Cheers
Paul-S
Okay so I finally got things semi-working (did a fresh ubuntu-install ;p )
ReplyDeleteGot the config.xml set up like yours. When opening a *.mov file I get:
[00000414] dc1394 demux error: Bad MRL, please check the option line (MRL was: /home/nannus/Skrivebord/clip.mov)
[00000452] avcodec encoder error: cannot open encoder
[00000405] stream_out_transcode stream out error: cannot find video encoder (module:ffmpeg fourcc:mp2v)
[00000405] stream_out_transcode stream out error: cannot create video chain
[00000426] main packetizer error: cannot create packetizer output (h264)
[00000414] dc1394 demux error: Bad MRL, please check the option line (MRL was: /home/nannus/Skrivebord/clip.mov)
[00000452] avcodec encoder error: cannot open encoder
[00000405] stream_out_transcode stream out error: cannot find video encoder (module:ffmpeg fourcc:mp2v)
[00000405] stream_out_transcode stream out error: cannot create video chain
[00000426] main packetizer error: cannot create packetizer output (h264)
[00000392] signals interface error: Caught Terminated signal, exiting...
[00000412] mux_ps mux: Close
[00000412] mux_ps mux: Close
[00000489] dummy demux: command `quit'
When trying to open youtube feeds I get a lot of 'cannot create access' and 'Bad MRL please check the option line (MRL was: /tmp/mt_transcode_AIPQNU)',
I haven't the foggiest what's going on here...
I get similar errors to Magnus when trying to stream mkv files. On the ps3 it just says media type not supported. Specifically, I see
ReplyDeletemain packetizer error: cannot create packetizer output (h264)
I don't get the MRL problem, but I haven't checked the output while trying to play Apple Trailers (media type not supported message on ps3 as well). All the errors I see when I try to play mkv files seem to stem from VLC. Config.xml matches and I followed your other tutorials for installing ffmpeg. My vlc is newer than the one you mention, installed from apt on ubuntu 8.10. Could that be part of the problem? I can post more detailed logs when I get back to my machine.
@Magnus: I get the same thing about the Bad MRL. Haven't found a solution. I used to get all of the other errors about not finding an encoder until I built vlc from source as JS' other tutorial demonstrates. I only have the MRL error now. Did you compile vlc from svn or get from the repos? Anyone have any idea about the MRL errors?
ReplyDeleteI fixed my earlier problem by building vlc from source as well. Now I just get the bad MRL error:
ReplyDelete[00000001] main libvlc debug: translation test: code is "C"
[00000391] dummy interface: using the dummy interface module...
[00000391] dummy interface: using the dummy interface module...
[00000409] mux_ps mux: Open
[00000411] dc1394 demux error: Bad MRL, please check the option line (MRL was: /Data/Videos/movie.mkv)
[00000409] mux_ps mux: Open
[00000411] dc1394 demux error: Bad MRL, please check the option line (MRL was: /Data/Videos/movie.mkv)
[00000389] signals interface error: Caught Terminated signal, exiting...
[00000389] signals interface error: Caught Terminated signal, exiting...
No other errors. It's just strange that the MRL it thinks is bad is the filename. I wish I could provide a little help.
Guys, don't worry about the 'Bad MRL'. This is just VLC complaining about being invoked with incomplete naming, i.e. 'vlc myFile.avi' instead of 'vlc file://myFile.avi'. AFAIK, it has no impact and is really more a warning than anything else.
ReplyDeleteThere seems to be a problem with vlc and ffmpeg when transcoding mkv files in Ubuntu (Hardy Heron). When i try to stream directly from Apple, it flickers a lot (noise) and i'm not even allowed to play mkv files with the current setup. (MediaTomb 0.12.0) compiled from source.
ReplyDeleteModify your config.xml with the following if you are running Ubuntu:
http://pastebin.com/m1e0b00fb
Works like a charm for me:)
Hey Anonymous, this one's a a keeper. It reliably works with Youtube and the mkv samples I have. Most Apple trailers work too. Thanks! I'll update the post right now.
ReplyDeleteHi, thanks for this guide, it helped me to get all my files on server viewable on the PS3.
ReplyDeleteHowever, I'm still concerned about how-to get the VOB-files playing "all-in-a-row"? Now I can play the VOB's one-by-one...and this is not so
I can't neither choose any subtitles so my question is, do I need to transcode the DVD (the VOB-files) in order to get the movie playing from the beginning to the end and to get the sub's?
Transcoding may not be an alternative for me, since my server is old "but still going strong" :)
However, I will give it a try if someone can answer my question...
Thanks!
/Kaizer
Thanks very much for this info.
ReplyDeleteWe installed an earlier version of MediaTomb on Linux in order to test it with the PS3 a few months ago. Can't wait to try your idea!
JS any chance of posting a copy of your config.xml file?
ReplyDeleteCheers
Thanks JS much appreciated :)
ReplyDeleteThanks JS for a great tutorial!! I have everything working now and I am loving it!
ReplyDeleteYou mention Last.FM a few times, and there is a spot included for it in the .xml file, but I am not seeing where I can access the last.FM resources in the MediaTomb menus? Can you give a little more info on how this feature works?
@wheaties: thanks for the kind words. You can't access last.fm from the MT menu: all you can do is 'scrobble' the music you're listening to with MT. Please see this post for more details:
ReplyDeletehttp://juliensimon.blogspot.com/2008/12/howto-adding-lastfm-scrobbling-to.html
Cheers!
Hi, tried your config and it works great for m2ts files...for mkv, I get a "Process terminated early" in the logs and the PS3 says the file is corrupted.
ReplyDeleteAlso, I can't seem to see the online content, anything else I have to do?
Thanks
Im having the same problem as the above poster, no online services folder being shown - help!
ReplyDeleteAfter a bit more reading to get the online services do I have to set up a new External Link object via the web interface? If so what are the settings?
ReplyDeleteThanks
@matg: man, that's a problem I DIDN'T have ;) AFAIK, you just have to enable YouTube in the config file and it shows up in the 'Video' part of the PS3 interface... You can also see the YouTube feeds being fetched in the mediatomb log.
ReplyDeleteDoes the box running mediatomb have Internet access ? Are you really using the latest sources, not the Ubuntu package ? Did you try deleting the database in ~/.mediatomb and rebuilding it?
strange all I get when media-video-generic is "corrupted data" on my PS3 and the console says "INFO: Arguments: %in %out".
ReplyDeleteAnyone else had this problem? or know what it can be?
Got the same problem with mkv files. Don't know why thought :P
ReplyDeleteHi Julien
ReplyDeleteThank you for the useful post. I've got a D-Link DSM-520 as a media-client and it cant play flac files, so I used your audio-generic profile. Now, the D-Link seems to be playing the flac file (as in the current position marker for the song seems to be moving) but I dont have any audio. :-(
Any ideas why there is no audio?
BTW, in the options for ffmpeg, shouldnt you include "-ab 192" to set the bitrate?
Thanks
Milind
Really usefull post about mediatomb.
ReplyDeleteIs thumbnails generation fast on your system ?
'cause before i used the transcoding options for thumbnails generation (with ffmpegthumbnailer too) : it was slow, one thumbnails was generated after the other one.
Now with the "internal" thumbnail mechanism, it is ... even slower, and some times some thumbnails aren't generated (if i go back to the parent directory then enter again in the same folder, this time it may works for the file it wasn't just before).
re: thumbnail generation: yes, I see the same thing. I guess it all depends on how fast your PC is... If thumbnails aren't generated fast enough, then timeouts will occur and the PS3 won't display some of them.
ReplyDelete@Milind:
ReplyDeletecan't really help with the D-Link, sorry. You should try the official mediatomb forum, I've seen lots of discussion on this device there.
About the bitrate: that's probably the default value, but it can't hurt to set it ;)
I'm having the same problem as matg. I have followed all the instructions here and I'm using the latest SVN version of mediatomb. I just don't see an online content folder from my PS3. No errors in the log just nothing. Any ideas where to even start looking?
ReplyDeleteHy , JS
ReplyDeletei use your config.xml for my unslung in my NSLU2
I moddif your config.xml to work in my unslung i arrive to play avi and divx but mkv and mpeg2 do want to play i have a messeage like "les données sont endommagées"
Mediatomb map this MKV because i see it but when i press the buttom to play i have this message
If some one can help mee i will apreciate
Regards
Hy , JS
ReplyDeletei use your config.xml for my unslung in my NSLU2
I moddif your config.xml to work in my unslung i arrive to play avi and divx but mkv and mpeg2 dont wanna play i have a messeage like "les données sont endommagées"
Mediatomb map this MKV because i see it but when i press the buttom to play i have this message
If some one can help mee i will apreciate
Regards
Sorry 4 my english
Hi Julien,
ReplyDeletemerci for the Mediatomb Howto. Almost everything works, except the text-to-speech transcoding, that can read textfiles. I am using espeak with mbrola. But how can I set it up in the config.xml. I added "object.item.audioItem.musicTrack"for text/* to see the txt-file in the browser. But I receive the error "linear PCM" not supported? Can you help me?
Thanks
Ole
For those who have followed the directions and are using the config.xml file but still can't see online services on the PS3, you probably need to set up your import.js file correctly. Copy the required sections out of the default import.js file that would have been installed in /etc/mediatomb. (I had a similar problem)
ReplyDeleteMy problem is with ffmpeg (to troubleshoot it, open up the script with nano and add 2> /tmp/ffmpeg-error.log to the end of the exec line): it gets a 2 signal part way into transcoding it, I think it may not be downloading the video quickly enough.
Is there a way to make it wait for the video?
Good guide, I followed the Gentoo guide but this works too. The only downside is having no seeking or pausing. Did anyone figure out how to do that? Not being able to pause or skip around in a video makes this hack cool, but mostly useless to me. Any suggestions?
ReplyDeleteThe Gentoo guide can be found : http://en.gentoo-wiki.com/wiki/MediaTomb#Select_the_Transcoder
Hi,
ReplyDeleteUnfortunately it doesn't work for me. When I try to play Youtube / Apple or mkv files a message appears that says the data is broken. In the mediatomb log file I see the following:
2009-06-22 17:13:24 INFO: Arguments: %in %out
Any clue how I can fix this?
Tia,
Paul
Same as Paultje. Can't get/play Youtube/Apple. Using your guide, your config file and i get the same in the log file:
ReplyDelete2009-06-26 14:12:37 INFO: Arguments: %in %out
Running Ubuntu 9.04
There was a comment earlier about an Ubuntu fix, but that post at the other site seems to have been deleted.
just discovered another problem when trying to play .flac audio. mediatomb log shows:
ReplyDelete2009-06-26 13:44:20 ERROR: process terminated early
2009-06-26 13:44:20 INFO: Arguments: -ac 2 -ar 44100 -y -i %in -f s16be %out
For those who experinced problems with ffmpeg (a-la %in %out):
ReplyDeletethere is a bug with latest libs
https://bugs.launchpad.net/medibuntu/+bug/269997
ffmpeg just couldn't find appropriate codecs
To solve just istall via aptitude unstripped versions of those libs.
Everything works fine then (except one bug in config with thumbnailer - solved too)
Hi. Many thanks for the tutorial. It`s great! Unfortunately I can`t get neither Apple Trailers nor Youtube to work. The links to the trailers from the RSS-feed don`t seem to work any more. For example http://movies.apple.com/movies/sony/2012/2012-tlr2_h640w.mov redirects to the Apple Trailer main-page, as the link doesn`t work.
ReplyDeleteAs far as Youtube is concerned, I`m getting the following error in mediatomb.log: ERROR: Failed to get URL for video with id (step 1)youtube_gdata
Can somebody help me out, please? Thanks
I too would like to thank the the author for a very informative post.
ReplyDeleteAs cavetroll mentioned, Apple Trailers fails to a redirect.
This is because Apple is expecting a Quicktime user-agent string in the http request.
To do this the 'mediatomb-video-generic' script needs to be updated to change the ffmpeg command like so:
wget --quiet -U 'QuickTime/7.6.2' ${INPUT} -O - | ffmpeg -y -threads 2 -i - -acodec ac3 -ab 192000 -vcodec mpeg2video -vb 4096000 -f dvd ${OUTPUT} &> /dev/null
Note that the audio codec has also been changed to 'ac3' without specifying number of AUDIO_CHANNELS.
This way you won't lose surround sound for many of those trailers that have it.
Cheers ;)
Hi Rick
ReplyDeleteThanks for that. Your command works well with Apple Trailers but unfortunately breaks all other format transcoding. Unless I`m missing something I can`t setup a transcoding profile for Apple trailers alone, as this would break .mov transcoding, too. Any suggestions?
Thanks
You can get around this by having the script parse the ${INPUT} text variable to see whether it is an Apple Trailers URL and set the ffmpeg command accordingly.
ReplyDeleteFor example:
if [[ -n "$(echo ${INFILE} | grep ^http://movies.apple.com)" ]]; then
wget --quiet -U 'QuickTime/7.6.2' ${INPUT} -O - | ffmpeg -y -threads 2 -i - -acodec ac3 -ab 192000 -vcodec mpeg2video -vb 4096000 -f dvd ${OUTPUT} &> /dev/null
else
ffmpeg -y -threads 2 -i ${INFILE} -acodec ac3 -ab 192000 -vcodec mpeg2video -vb 4096000 -f dvd ${OUTPUT} &> /dev/null
fi
That worked like a charm! Many thanks!
ReplyDeleteI was thinking of an if-else statement but didn`t know how to implement it, as I`m not that familiar with the syntax of bash-scripting. Time to learn...
Anyway. That problem solved another one occured. I re-installed a service called mt-daapd which can publish a specific folder to appear as a Shared Library in iTunes. This package depends on libavcodec, libavcodec52 and libavutil49. Those libs get installed in /usr/lib. As soon as they are there, ffmpeg is broken. I get this error message: ffmpeg: symbol lookup error: /usr/local/lib/libavdevice.so.52: undefined symbol: av_free_packet
I really don`t know what`s going on as it points to the correct lib. There must be some problems with library linking, I guess. I`m no Linux expert, but it should be possible for local libs (/usr/local/lib) to co-exist with system wide libs (/usr/lib), non?
I guess the same would happen if I`d install any other package (like vlc...) that is dependent on those libav* libs in /usr/lib
This is driving me crazy as I can`t find a solution for this. Again, any help or advice would be highly appreciated.
Thanks
I've tried doing what Rick H said, but this caused Apple trailers to fail with a network error. But i'm not sure if i did it correctly.. I changed the ffmpeg command that was in "mediatomb-video-generic" to
ReplyDeleteif [[ -n "$(echo ${INFILE} | grep ^http://movies.apple.com)" ]]; then
wget --quiet -U 'QuickTime/7.6.2' ${INPUT} -O - | ffmpeg -y -threads 2 -i - -acodec ac3 -ab 192000 -vcodec mpeg2video -vb 4096000 -f dvd ${OUTPUT} &> /dev/null
else
ffmpeg -y -threads 2 -i ${INFILE} -acodec ac3 -ab 192000 -vcodec mpeg2video -vb 4096000 -f dvd ${OUTPUT} &> /dev/null
fi
Was this correct? And if so...why do I get a network error?
the ${INFILE} in the if should be ${INPUT}, then it works for me.
ReplyDeleteBut I also have the same problem Cavetroll has with the youtube thingy:
mediatomb.log:
ERROR: Failed to get URL for video with id (step 1)youtube_gdata
Is this a bug that's fixed or something else?
And thanks for the great info on this!
It seems the issues with Youtube is a change in the RSS feed that prevents the XML parser finding the right link.
ReplyDeleteRead more here: http://sourceforge.net/projects/mediatomb/forums/forum/440751/topic/3437844
Great tutorial. Do you happen to know how to transcode for iPhone on the fly? I have an UPnP app called PlugPlayer which works great, but will only work with files that already work on my iPhone. I'd like to be able to transcode files on the fly (like avi) to play in my iPhone without having to convert them (if possible).
ReplyDeleteI'd like to suggest updating the mediatomb-video-generic script listed in the how-to to be the working one of:
ReplyDelete#!/bin/bash
INPUT="$1"
OUTPUT="$2"
VIDEO_CODEC="mpeg2video"
VIDEO_BITRATE="4096k"
AUDIO_CODEC="mp2"
AUDIO_BITRATE="192k"
AUDIO_SAMPLERATE="48000"
AUDIO_CHANNELS="2"
FORMAT="dvd"
if [[ -n "$(echo ${INPUT} | grep ^http://movies.apple.com)" ]]; then
wget --quiet -U 'QuickTime/7.6.2' ${INPUT} -O - | ffmpeg -y -threads 2 -i - -acodec ac3 -ab 192000 -vcodec mpeg2video -vb 4096000 -f dvd ${OUTPUT} &> /dev/null
else
ffmpeg -y -threads 2 -i ${INPUT} -acodec ac3 -ab 192000 -vcodec mpeg2video -vb 4096000 -f dvd ${OUTPUT} &> /dev/null
fi
...because the original does not work.
Cheers Dark1 that worked a treat ;)
ReplyDeleteThank you for the updates to the transcoding script, Rick H and Dark1.
ReplyDeleteThere is one thing I'm curious about, the Apple trailers are available up to 1080p resolution, but my mediatomb won't let me use higher than 720p. Will 1080p support come?
Paul-S: I can't take any credit. I was just suggesting that the author update his post to have the working script that Rick H posted (and Elias corrected).
ReplyDeleteI *still* can't get DVD working. The iso shows up and 99 audio tracks which is weird since I have VOB mapped to video/mpeg, there are no audio only tracks and besides that there are only 50 VOB tracks.
Excellent job all round on this. Many thanks. I've got everything working well...except youtube. Maybe I'm missing something, but cant see what. I'm getting a "failed to get XML content from YouTube service" message in the terminal window. I'd be grateful for any direction as to what I should be looking for.
ReplyDeleteHere is the proper coding for the mediatomb-video-generic script. Works perfectly for me.
ReplyDelete#!/bin/bash
INPUT="$1"
OUTPUT="$2"
VIDEO_CODEC="mpeg2video"
VIDEO_BITRATE="4096k"
AUDIO_CODEC="mp2"
AUDIO_BITRATE="192k"
AUDIO_SAMPLERATE="48000"
AUDIO_CHANNELS="2"
FORMAT="dvd"
if [[ -n "$(echo ${INPUT} | grep ^http://movies.apple.com)" ]]; then
wget --quiet -U 'QuickTime/7.6.2' ${INPUT} -O - | ffmpeg -y -threads 2 -i - -acodec ac3 -ab 192000 -vcodec mpeg2video -vb 4096000 -f dvd ${OUTPUT} &> /dev/null
else
ffmpeg -threads 2 -i "${INPUT}" -vcodec ${VIDEO_CODEC} -b ${VIDEO_BITRATE} \
-acodec ${AUDIO_CODEC} -ab ${AUDIO_BITRATE} -ar ${AUDIO_SAMPLERATE} -ac ${AUDIO_CHANNELS} \
-f ${FORMAT} - > "${OUTPUT}" 2>/dev/null
fi
The URL of the apple trailers has changed. You need to modify the "if" statement od the mediatomb-video-generic script from movies.apple.com to trailers.apple.com :
ReplyDeleteif [[ -n "$(echo ${INPUT} | grep ^http://trailers.apple.com)" ]]; then
Then i works again. Thanks a lot for all the hints!
02.2012:
ReplyDeleteTo make the apple trailer work again modify source:
/src/atrailers_content_handler.cc line 143
temp = temp.replace(_("movies"), _("www"));
to
temp = temp.replace(_("movies"), _("movies"));
very quick fix but it works ;)
Anyway i'm experiencing a problem, MT create succesively two /tmp/mt_transcode_XXXX when transcoding one trailer, as soon as he create the second file, trailer stop, i send a log exampple in next message (4096 chars limit)
please Help ! it's so close to work ;)
Hi again,
ReplyDeleteJust a little feedback, if you use a Freebox Revolution V6 doesn't read trailers commpletely and stop before end, XBMC doesn't have the probleme.
So we can consider Apple Trailers work nicely at this date.
regards.