prioryjim
Posts: 108
Joined: Tue Mar 06, 2012 12:23 pm
Location: Preston, UK

anyone got trancoding with mediatomb/xbmc

Mon Oct 08, 2012 7:26 am

I have a beefy Ubuntu server holding my video library.
And raspbmc with xbmc on my pi

Anyone got a mediatomb config.xml that implements transcoding to the pi HD format,
mediatomb would run on Ubuntu.

Thanks.
Jim

masterluke
Posts: 200
Joined: Tue Apr 17, 2012 4:10 pm

Re: anyone got trancoding with mediatomb/xbmc

Tue Oct 09, 2012 5:01 pm

What encoding are the source files? Are you sure Pi xbmc doesn't play them natively?

I fiddled with mediatomb on an Ubuntu box, but now I just stream over nfs since there is hardware mpeg2.

prioryjim
Posts: 108
Joined: Tue Mar 06, 2012 12:23 pm
Location: Preston, UK

Re: anyone got trancoding with mediatomb/xbmc

Wed Oct 10, 2012 8:16 am

Various formats but mainly TS with some MOV
Thanks
Jim

River_son
Posts: 1
Joined: Thu Oct 11, 2012 7:17 am

Re: anyone got trancoding with mediatomb/xbmc

Thu Oct 11, 2012 7:21 am

I couldn't but finally found that the fastest way to share my media library was pure ftp between my busybox linux system and the rasp pi.

prioryjim
Posts: 108
Joined: Tue Mar 06, 2012 12:23 pm
Location: Preston, UK

Re: anyone got trancoding with mediatomb/xbmc

Fri Oct 12, 2012 6:39 am

But I need transcode the TS files to HD for PI to play.
Thanks
Jim

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: anyone got trancoding with mediatomb/xbmc

Fri Oct 12, 2012 11:17 am

What are the codecs involved ?

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

prioryjim
Posts: 108
Joined: Tue Mar 06, 2012 12:23 pm
Location: Preston, UK

Re: anyone got trancoding with mediatomb/xbmc

Fri Oct 12, 2012 1:09 pm

Hmm not an expert on codecs and video transcode.
How do I determine them
Using ffmpeg on a ts I get the following, does that help ?


ffmpeg version 0.8.3-4:0.8.3-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
built on Jun 12 2012 16:52:09 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
[mpegts @ 0x24357a0] max_analyze_duration reached
Input #0, mpegts, from 'wnmhgb.ts':
Duration: 00:48:20.06, start: 0.287267, bitrate: 5349 kb/s
Program 258
Stream #0.0[0xe0]: Video: mpeg2video (Main), yuv420p, 720x576 [PAR 16:15 DAR 4:3], 9800 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0.1[0x80](eng): Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s
Stream #0.2[0x81](eng): Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s
Stream #0.3[0x82](eng): Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s
Stream #0.4[0x83](eng): Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s
Stream #0.5[0x84](eng): Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s
At least one output file must be specified

prioryjim
Posts: 108
Joined: Tue Mar 06, 2012 12:23 pm
Location: Preston, UK

Re: anyone got trancoding with mediatomb/xbmc

Mon Oct 15, 2012 6:53 am

Well after lots of fiddling ....
1) I purchased the 2 license keys for the other formats. This should allow me to play TS directly , I think, when they arrive.
2) I got mediatomb transcoding to work without 1) , results as below.
It uses a script I found on the web, I cloned and modified it as required.
Script uses avconv
It transcodes TS to mp4 and also mpeg to mp4.
Both files play OK on XMBC under raspbmc.
I guess other formats should be possible.
Pause works but no fast forward. Must be cause it's a stream, need to investigate more.
Anyone interested I could supply script/config.xml

Note keys for 1) have arrived this morning, will try them tonight.
Thanks
Jim

prioryjim
Posts: 108
Joined: Tue Mar 06, 2012 12:23 pm
Location: Preston, UK

Re: anyone got trancoding with mediatomb/xbmc

Tue Oct 16, 2012 7:20 am

Installed license keys last night.
Now TS files don't need Mediatomb to transcode.
Transcoded or not the fast forward does work sort of.
But I guess it only works as fast as the network/Mediatomb/transcoder can feed it !
Often the video will just stop.
Pause seems OK.
Playback is faultless.
My test bed uses a hard wired LAN on a port next to the media server LAN port.
So it will be as good as it gets.
Tried with my WiFi 150mbps dongle on pi.
Still seemed OK but proper HD files often stop and XMBC says buffering and then it starts again.
Note: it seems OK with my WiFi in one USB port and my wireless keyboard/mouse dongle in the other. Don't seem to need a powered hub, I think !

Anyone else using Mediatomb ??
Jim

prioryjim
Posts: 108
Joined: Tue Mar 06, 2012 12:23 pm
Location: Preston, UK

Re: anyone got trancoding with mediatomb/xbmc

Wed Oct 17, 2012 6:36 am

Installed BBC iplayer.
Worked out of the box.
Also seems to work OK over WiFi.
Although my Pi is in same room as WiFi router.
Will try downstairs at some point.
JimL

prioryjim
Posts: 108
Joined: Tue Mar 06, 2012 12:23 pm
Location: Preston, UK

Re: anyone got trancoding with mediatomb/xbmc

Sat Oct 20, 2012 6:24 am

Someone ask for the transcode details
I cribbed/copied some info from
http://mediatomb.cc/dokuwiki/transcoding:transcoding
And modified it as I needed.
There are two parts
1) Mods to /etc/mediatomb/config.xml
2) A script called /usr/local/bin/mediatomb.transcode.bash
Basically when mediatomb plays a file with a mime type in the transcode section of config.xml
it creates a named pipe in /tmp and then calls the script to do the transcode.
The script is given the filename to transcode and the pipe to send it to.
Details follows (could be improved on )

prioryjim
Posts: 108
Joined: Tue Mar 06, 2012 12:23 pm
Location: Preston, UK

Re: anyone got trancoding with mediatomb/xbmc

Sat Oct 20, 2012 6:25 am

Create a file
/usr/local/bin/mediatomb.transcode.bash
and chmod it to 777

#!/bin/bash

INPUT="$1"
MEDIATOMB_FIFO="$2"
TS_TRANSCODED_FILE="/tmp/dummy.ts"

function transcode_video_ffmpeg_mpeg2_ac3_ts
{
# Create the ts buffer file
# Note : Emptying the ts buffer file maybe make unuseful the use of the ffmpeg -y option.
rm -f "${TS_TRANSCODED_FILE}"
touch "${TS_TRANSCODED_FILE}"

# Start to stream the ts buffer file to the mediatomb fifo pipe in background
tail -q -c 1024 -f "${TS_TRANSCODED_FILE}" > "${MEDIATOMB_FIFO}" &

# Start to transcode, ouputing to the ts buffer file
# Note : I know I can replace this bash process by the ffmpeg process using 'exec ffmpeg -y ...'
# ffmpeg -loglevel quiet -y -i "${INPUT}" -vcodec mpeg2video -sameq -r 25 -s ega -acodec ac3 -ar 44100 -ac 2 "${TS_TRANSCODED_FILE}"
# avconv -y -i "${INPUT}" -acodec copy -vcodec copy "${TS_TRANSCODED_FILE}" 2>&1 >/tmp/jimslog.log
#/usr/bin/avconv -loglevel quiet -y -i "${INPUT}" -acodec copy -b 1200k -vcodec mpeg4 "${TS_TRANSCODED_FILE}"
echo /usr/bin/avconv -loglevel quiet -y -i "${INPUT}" -acodec copy -b 1200k -vcodec mpeg4 "${TS_TRANSCODED_FILE}" >/tmp/jim1.log
/usr/bin/avconv -loglevel quiet -y -i "${INPUT}" -acodec copy -b 1200k -vcodec mpeg4 "${TS_TRANSCODED_FILE}"

}

transcode_video_ffmpeg_mpeg2_ac3_ts

prioryjim
Posts: 108
Joined: Tue Mar 06, 2012 12:23 pm
Location: Preston, UK

Re: anyone got trancoding with mediatomb/xbmc

Sat Oct 20, 2012 6:29 am

changes to /etc/mediatomb/config.xml ( back it up first )
You should be able to work out where they go

<map from="ts" to="video/mp2t"/>

<transcode mimetype="video/mp2t" using="humax-ts"/>
<transcode mimetype="video/mpeg" using="humax-ts"/>

<profile name="humax-ts" enabled="yes" type="external">
<mimetype>video/mp4</mimetype>
<accept-url>no</accept-url>
<first-resource>yes</first-resource>
<accept-ogg-theora>no</accept-ogg-theora>
<agent command="mediatomb.transcode.bash" arguments="%in %out"/>
<buffer size="1000000" chunk-size="10000" fill-size="200000"/>
</profile>

prioryjim
Posts: 108
Joined: Tue Mar 06, 2012 12:23 pm
Location: Preston, UK

Re: anyone got trancoding with mediatomb/xbmc

Sat Oct 20, 2012 6:34 am

Notes on above
It seems to create lots of "tail" processes, need to look at that.
You can see them with
ps -ef | grep tail
You can kill them with
pkill tail

I had a problem where things wouldn't play
I removed /tmp/dummy.ts and things worked

Let me know if you have success.
Don't forget to stop/start mediatomb after changing config.xml
Also if you buy the codec licenses ( approx £4.00 ) you shouldn't need to transcode.

Jim

prioryjim
Posts: 108
Joined: Tue Mar 06, 2012 12:23 pm
Location: Preston, UK

Re: anyone got trancoding with mediatomb/xbmc

Sat Oct 20, 2012 6:37 am

To detetmine the mime type of a file use
file -i myvid.ts
Jim

Return to “Media centres”