Log in

View Full Version : Streaming .h264 to PS3 over Mediatomb on Linux - Newbie needs help!


russellhq
19th May 2008, 09:48
As the title suggets, I am trying to stream my media collection to the PS3 from my linux box using Mediatomb.

I've setup Mediatomb (compiled from source, what a task!) and have it interacting with the PS3 i.e. can stream divx movies in avi containers no problems.

My next project is to stream my mkv files, these contain 720p .h264 video and ac3 audio.

Using Mediatomb, you can change the mimetype of mkv files on the fly and also you have an option to use a transcoder to convert them to a suitable format. The transcoder uses 3 arguments and uses a FIFO output file to do the streaming:
agent: program/script used to transcode
%1 : input file (this is the file on the box)
%2 : outfile (this is the file streamed to the PS3)

I tried a basic script to use ffmpeg to conver the mkv files to mpeg2

exec ffmpeg -i %1 -vcodec mpeg2video -sameq -acodec mp2 b 192000 -ar 44100 -ac 2 -f dvd - > %2

The code above is from memory but it went somthing like that, I wanted to make something compatible that would work hence the downsampling of the audio and use of mpeg2video.

What I would like to do is copy the streams as they are and mux them into a suitable container that the PS3 supports.

As I understand it the PS3 (XMB Player if that's what it's called) can play h264 level 4.1 and AC3 audio. From what I have read, it is likely that most of my mkv files are level 5.1 and need changed to 4.1. This can be done via a simple hex edit.

What I would like to know is would it be possible to use Mediatomb and the FIFO set-up and create a script that would take the input file from mediatomb (the mkv), change it to lvl 4.1 then output it to something that the PS3 could read?

I had imagined something like this:

#
use a program like mvkextract to demux to 2 fifo files
then use a program like tsmuxer to mux the files while changing 5.1 to 4.1 back to one compatible file that is also a fifo that will then be read back into Mediatomb.

My goals are:
1) Stream my HD media on my Linux box to my PS3

My Limitations are:
Slow Linux box cannot perform realtime transcoding

My workaround
repackage the files on the fly via FIFO to work with Mediatomb



I'm a total newbie on Linux so I hope that made sense and hope someone can help!

Thanks,


Russell

B4tm4n
19th May 2008, 10:29
Don't bother with on the fly transcoding, the quality is crap. Use tsMuxer to transcode the files first to .ts or .m2ts and stream those, it only takes a minute or so for a 45 min TV episode. You can run tsmuxer under wine on a Linux box, I run it on a Mac using wine.
http://forum.doom9.org/showthread.php?t=134104

russellhq
19th May 2008, 11:05
When I say transcode, i really mean repackage on the fly i.e. take it out the mkv container and put it into a ts container without touching the streams.

B4tm4n
19th May 2008, 11:20
When I say transcode, i really mean repackage on the fly i.e. take it out the mkv container and put it into a ts container without touching the streams.

Thats what tsMuxer does, but not on the fly.

russellhq
19th May 2008, 12:02
Is there any program that would remux to a FIFO file if tsmuxer can't do this?

B4tm4n
19th May 2008, 19:58
No idea.

russellhq
20th May 2008, 10:44
Thanks for the help so far, but looks like I'm going to get stuck again!

I tried the following steps to test the hex-edit step

1) mkvextract test.mkv 1:audio.ac3 2:video.h264
2) mediainfo video.h264 'h264 profile is 5.1
3) audio.ac3 is AC3 6 channel 48000Hz 320kbps
4) hexedit video - Found 640033 replaced with 640029 'changes Level from 5.1 to 4.1
5) mediainfo video.h264 'h264 profile has changed to 4.1
6)ffmpeg -i video.h264 -r 23.976 -f h264 -vcodec copy -i audio.ac3 -f ac3 -acodec copy -f vob outfile.vob
This created a vob file with the hex-modified video track and the original audio track.

Loaded up mediatomb and turned on the PS3. Found the file but the PS3 says "data corrupted" :(

Any ideas?

B4tm4n
20th May 2008, 20:39
Get the latest version of tsMuxer. There no need to demux the mkv, import it straight into tsMuxer.
Theres also no need to hex edit, you can change the Level from 5.1 to 4.1 via the gui of tsMuxer.

russellhq
21st May 2008, 18:55
I get the following error when trying to run tsmuxer:

[bash-3.1# tsmuxer
/root/tmp/tmp.EXjlY13498/tsmuxer: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /root/tmp/tmp.EXjlY13498/tsmuxer

B4tm4n
22nd May 2008, 09:21
I get the following error when trying to run tsmuxer:

[bash-3.1# tsmuxer
/root/tmp/tmp.EXjlY13498/tsmuxer: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /root/tmp/tmp.EXjlY13498/tsmuxer


Are you using wine ?

russellhq
22nd May 2008, 11:31
Nope, using the Linux version.

Can is use wine from the command line i.e. to script the task.

B4tm4n
22nd May 2008, 14:52
Nope, using the Linux version.

Can is use wine from the command line i.e. to script the task.


Totally forgot, there was a linux version.
I don't know much about linux, you'll have to ask in the tsMuxer thread for help on that.

ChuckleWorthy
10th July 2008, 08:30
Nope, using the Linux version.

I found the Linux version of tsMuxer would mux just fine, however when examining the generated m2ts file (via tsMuxer [Linux & Win32 versions]) the audio stream would undetectable. I now use the Win32 version via Wine - works a treat.

Linux Distro: Ubuntu Gutsy