PDA

View Full Version : h.264+AC3 in m2ts to PS3


blaz
6th May 2008, 16:55
Apparently the PS3 supports h.264 video + AC3 audio in an m2ts file.

But how to do this in linux?

I've got an h.264 file that plays fine in an mp4 on the PS3. And the aac audio comes from an AC3 track that should be good.

But when I use the latest linux version of tsMuxeR (older than the windoze version) to put the h.264 and AC3 files together, the PS3 refuses to recognize the result. VLC plays it fine in Linux though.

These files come off a dvd, not Blu-Ray or anything hi-definition.

nm
6th May 2008, 20:51
Two options come to mind if the problem is fixed in newer versions of tsMuxeR:
- politely ask a newer Linux version from the developers
- run the Windows version with Wine.

blaz
6th May 2008, 23:59
I take there are no other Linux options out there?

Not really sure where the problem is, the PS3 is soooooo picky.
But maybe the latest tsMuxeR will fix it. I'll try the latest in wine ...

Thanks.

nm
7th May 2008, 08:59
I take there are no other Linux options out there?
There is FFmpeg, but IIRC, the current TS muxer has some problems and the new muxer developed in GSoC 2007 has not been finished yet. Also VLC supports TS muxing. I have no idea if the output from either of these works on PS3.

There are some usage tips for these tools here:
http://forum.doom9.org/showthread.php?t=97900

blaz
7th May 2008, 17:20
Thanks again.

Using vlc to transcode an avi with h264+ac3 into m2ts gives me the same error in linux (audio but no video) as discussed in the link you posted. And it's not recognized by the PS3.

A possible solution is to mux the two raw files, but I see no way of doing that in vlc?

When I mux the 2 files with ffmpeg, get this error: [mp2 @ 0xb7d0e410]encoding 6 channel(s) is not allowed in mp2
Since I want 6 channel audio, this is no good.

But: ffmpeg -i temp.avi -acodec copy -vcodec copy -f mpegts out.m2ts
does sort of work. mplayer can play it, vlc is choppy but plays.
But PS3 doesn't. Claims the video is mpeg-ts and doesn't recognize the audio.

Also tried avidemux, copying the h264+ac3 streams in an avi to an mpeg-ts file, but got an error saying the streams were not MPEG compatible, etc.

So as linux isn't working out too well, I've got the latest windoze version of tsMuxeR running under wine but need to sort out some missing codec issues.

blaz
7th May 2008, 18:17
The codec issue with the new tsMuxeR and wine is only with the gui version. But when I run the new cli version under wine, it's the same result as before: works fine in linux but the PS3 says it's unsupported data; it recognizes the AC3 audio stream but not the video.

Which reminds me of a comment in that link posted earlier:
"The reason why sometimes vlc doesn't work is that when muxing to TS it expects to find AVC in bytestream format # (NALS prefixed by 0x000001 as mpeg1/2/4), that for is never the case when the original stream is contained in mp4/mov # and sometimes in avi (when the fourcc is avcc). In cases like those AVC is in raw NAL format, that unfortunately can only # be muxed in SL substreams when inserted in TS (that vlc doesn't even read)"

I strip the h264 video out of an avi created by mencoder with:
MP4Box -aviraw video temp.avi

Would that create a "bytestream" or "raw NAL" file? I have NO idea what those two terms mean, so is this even relevant to tsMuxeR?

Or maybe my mencoder h264 encoding options are off, but they work fine on the PS3 in an mp4 file as they are lifted directly from h264enc...

blaz
9th May 2008, 05:49
Turns out it's a problem with the h.264 video. Although it works fine in mp4 files, the PS3 doesn't like it in m2ts files.

And the solution is to run the h.264 video through h264info, a windoze program that runs in wine. Then use the older linux version of tsMuxeR (or the newer windoze version) along with the ac3 file to get an m2ts that runs on the PS3.

I dunno what h264info does, but the source code is available at the sourceforge site for anybody interested in figuring it out.

blaz
28th May 2008, 01:33
Got the h264info V25 source code from the author and converted it to linux cli interface.

It can be downloaded from: http://www.savefile.com/files/1577164

Still not sure what it does, but it definitely transforms h264 video into something that the PS3 will accept with ac3 audio in an m2ts file.

Grimmi Meloni
1st June 2008, 12:31
Wow, blaz! You actually did a port of h264info? Respect!!!

Since I´m a lost Linux soul myself: Could you please post your complete batch you are using?

Right now I´m using a combination of mkvextract, a selfmade java tool to automate the hexedit video level change 5.1->4.1, and mp4box. But this only gives me an mp4 container with stereo AAC. So I´d really like to know the exact steps you are taking to create the m2ts.

Thanks!

blaz
3rd June 2008, 06:14
Since I´m a lost Linux soul myself: Could you please post your complete batch you are using?


I'd like to, but I'm traveling for a few weeks and don't have that stuff on my portable.

But you should be able to put it together by starting with the batchfile created by h264enc. I use the hi-qual ps3 option and elect to pass thru the AC3. Taking the mencoder part of this batch gives you an h264 video + ac3 audio in an avi file. (The h264 in this file is 4.1)

Then strip out the video and audio parts with mp4box. Run the video through h264fix and use tsmuxer to put them back together again (both with just the defaults).

All my videos come from dvd's, but you should also be able to use the h264enc's mencoder code as a basis for transcoding other files.

Grimmi Meloni
4th June 2008, 17:52
Thanks for the info. In the mean time I put something together myself. I´m a bit confused though. My current solution uses tsRemuX for the whole process. I basically have a batch that creates a meta file with the following contents:

V_MPEG4/ISO/AVC, $FILENAME, track=$VIDEO_TRACK_ID, level=4.1, insertSEI, contSPS
A_AC3, $FILENAME, track=$AUDIO_TRACK_ID

Works like a charm here. Why don´t you just use that approach? Are there any known problems with tsremux I should known of?

blaz
6th June 2008, 05:39
I'm ripping dvd's, so I need to create the h264 file. And the h264's are set to level 4.1 during the encoding so that's not the problem I'm having.

But I'll try tsremux when i get back. Maybe I can replace the h264info+tsmuxer step.

blaz
21st June 2008, 01:15
>>But I'll try tsremux when i get back.

Can't get it to run in my wine installation...
Written in C# which I know little to nothing about,
so cannot convert ...

>>Maybe I can replace the h264info+tsmuxer step

No, think not.

Grimmi Meloni
21st June 2008, 09:31
I´m using the linux version of tsremux. Works like a charm over here.

Heres the complete script i`m using:


#!/bin/bash
set -x

function rcCheck {
if [ $? -ne 0 ]
then
echo Something went wrong...
exit 1
fi
}

TSMUXERHOME=$HOME/public/tsmuxer

if [ $# -eq 0 ]
then
echo forgot filename
exit1
fi

while [ $# -ge 1 ]
do
FILENAME=$1
BASENAME="`basename "$FILENAME" .mkv`"

AUDIO_TRACK_ID=`mkvmerge -i "$FILENAME" | grep 'A_AC3' | sed -e 's/Track ID \(.\):.*/\1/'`
VIDEO_TRACK_ID=`mkvmerge -i "$FILENAME" | grep 'V_MPEG4/ISO/AVC' | sed -e 's/Track ID \(.\):.*/\1/'`

if [ -z "$AUDIO_TRACK_ID" -o -z "$VIDEO_TRACK_ID" ]
then
echo "Could not identify Streams IDs!"
exit 1
fi


#old meta line with level conversion
#V_MPEG4/ISO/AVC, $FILENAME, track=$VIDEO_TRACK_ID, level=4.1, insertSEI, contSPS


cat <<EOF >"${BASENAME}.meta"
V_MPEG4/ISO/AVC, "$FILENAME", track=$VIDEO_TRACK_ID, insertSEI, contSPS
A_AC3, "$FILENAME", track=$AUDIO_TRACK_ID
EOF
rcCheck

$TSMUXERHOME/tsMuxeR "${BASENAME}.meta" "${BASENAME}.m2ts"
rcCheck

chmod o+r "${BASENAME}.m2ts"
rm "${BASENAME}.meta"

shift 1
done

sierra3
22nd June 2008, 03:47
This is the best place I could find for this question.

I have a home brew DVB-S application.
I can record raw transport stream files with no problem
.ts files can hold mpg2/pcm or h264/ac3
If I stream these to my PS3 using TwonkyMedia (or any other media server), I get video but no audio.

If I run tsRemux to convert same file from .ts (188 byte packets) to .m2ts (192 byte packets) the files play perfectly on my PS3.

However, don't want to 'remux' all of the time.

If I could figure out what the 4 byte blue-ray/timecode was supposed to be (bit format), I could record directly to .m2ts and even stream live-tv to my PS3.

Any hints? Anyone? Bueller?

(thanks)

blaz
23rd June 2008, 14:54
I´m using the linux version of tsremux.

Where and which version is it? My experience was with the latest download (Windoze only) from the author's Doom9 thread.

Googling around I've found this message posted elsewhere:
"TSRemux has an older version compiled for Linux, but it won't run on any modern distribution because it was compile with an ancient glib version."

But I haven't found this linux version to try on my machine.

Grimmi Meloni
23rd June 2008, 15:17
Where and which version is it? My experience was with the latest download (Windoze only) from the author's Doom9 thread.

Ahh... now I see. I mixed things up, blaz. I'm talking about tsmuxer whereas you seem to be talking about tsRemux. Me, I'm using tsmuxer in version 1.7.3(b) available in this thread (http://forum.doom9.org/showthread.php?t=134104).

Sorry, If I caused any confusion.

blaz
24th June 2008, 00:27
Yup. Up in post #11 & #14 you were talking about TsRemux.

Anyway, I'm using tsmuxer too, but I have to "fix" the video h264 file with h264info to get the m2ts to play with the PS3.
If you don't have to do that with your videos, more power to you.
It may be the mencoder options that I'm using to create the h264 files, but I've tried numerous variations with no luck.

Just recently heard that you can even put the h264 + ac3 streams of an mkv file into a vob with mk2vob and the ps3 will play it.
Not sure at this point whether I want to fool around with that or not.
Last I heard, there were issues with pausing and fast-forwarding with vobs ...

Besides, the m2ts works fine.
I'm happy :)

Grimmi Meloni
24th June 2008, 08:50
Just recently heard that you can even put the h264 + ac3 streams of an mkv file into a vob with mk2vob and the ps3 will play it.
Not sure at this point whether I want to fool around with that or not.
Last I heard, there were issues with pausing and fast-forwarding with vobs ...

I can confirm those ff/rew problems. Does not seem to work that well. As far as I know, h264 in VOB is out of spec, therefore no guarantee that it will always work. Anyway, the tsmuxer does just fine.

About your problems you are still experiencing: Have you tried those "insertSEI, contSPS" I'm using? Without them (at least without one of them) the files do not play on my PS3 as well.
On the other hand: If you have a working setup for your needs - who cares? :)