Log in

View Full Version : Guide on mux h.264 and DTS/AC3 into TS


orbitlee
26th November 2006, 18:19
I found the following solution which can mux DTS/AC3 audio track and h.264 video into mpeg2 transport stream, with free tools. My friend and I tried this solution on at least 30-40 h.264 caps released by abhdtv recently with success, including BBC, Sky and Premiere. All credits go to the developers and cappers.

1. Demux h.264 video from TS
Quite a few utilities are available to extract h.264 es from original ts. Choose your favorite. For example,
mplayer -dumpvideo -dumpfile raw.264 raw.ts

2. Mux video into mp4
I use mp4creator in mpeg4ip package. The synatx is
mp4creator -create=raw.264 -rate=25 -use64bits raw.mp4

Take care at here. -use64bits is a must if size of raw.264 is beyond 4G, otherwise the mp4 output will screw up. For the rate value, it depends on the audio track you want to mux. If the audio is NTSC, use 23.976. If the audio is PAL, use 25.

3. Mux audio into mkv
Mkvtoolnix(I use 1.7.0, checked 1.8.1 today with no problem) can mux mp4 and DTS/AC3 audio track into mkv. You can specify timecode at here if you use the incorrect rate at previous step. Also, make sure the delay of audio track can keep A/V sync.

4. Stream output MKV into TS
VLC can stream MKV into TS. Launch VLC media player,
File-Open File-Open the mkv output by previous step.
Enable "Advanced options-Stream/Save"
Click the settings,
Enable "Outputs-File", specify the output filename
Make sure "Encapsulation Method" is MPEG TS
Enable "Select all elementary streams"
After two OKs, VLC is streaming and you will get the TS you want.

The most confused part of this guide, you need correct VLC version. You have to use nightly build instead of offical release.
VLC Nightly build(win32) is available at here
http://nightlies.videolan.org/build/win32/?C=N;O=D

I use 20061014 build, this is the last build which can make the outputed TS playable with Gabest mpeg splitter. The reason I use Gabest mpeg splitter is, it is the only(so far I know) directshow splitter which supports both h.264 video and DTS audio in TS stream. According to the VLC revision log, developers changed the h.264 packetizer at 2006/10/16 to make ffmpeg happy, but Gabest mpeg splitter does not work after 20061018 build. Well, I wish there is a way to make both happy :-)


To playback the output TS, you need a directshow based player, gabest mpeg splitter(you need new version since very old version does not support h.264 ts), and h.264 decoder(coreavc and cyberlink tested)

Alkasar
29th July 2007, 22:00
This is the first method we tried here (http://www.homecinema-fr.com/forum/viewtopic.php?t=29842614) (french only) to remux mkv with h264 video into TS. (using mp4box instead of mp4creator)

unfortunately, in our experience, VLC will only mux very few h264 video files. Even the nigthly builds are ...capricious with h264.

enjoyer
30th July 2007, 12:33
This is the first method we tried here (http://www.homecinema-fr.com/forum/viewtopic.php?t=29842614) (french only) to remux mkv with h264 video into TS. (using mp4box instead of mp4creator)

unfortunately, in our experience, VLC will only mux very few h264 video files. Even the nigthly builds are ...capricious with h264.

I dont understand french :(

is there working method to remux mkv to ts???

Schmendrick
30th July 2007, 14:19
Actually the method Alkasar is refering to is using the mainconcept muxer to produce a ts-file. If you have this mainconcept muxer installed on your system then you can also use graphedit to feed this muxer. Or you can use Elecard Emuxer in the first place.

enjoyer
30th July 2007, 15:25
Actually the method Alkasar is refering to is using the mainconcept muxer to produce a ts-file. If you have this mainconcept muxer installed on your system then you can also use graphedit to feed this muxer. Or you can use Elecard Emuxer in the first place.

and that worked???

I tried xmuxer but the result is corrupt :(

Schmendrick
30th July 2007, 16:25
I guess it depends on the properties of your source. I am not sure what the limitations using the mainconcept muxer are, if they cannot multiplex MBAFF or PAFF containing video stream or what else causes a problem. One thing I have found out is that the mainconcept muxer by default assigns an audio-stream ID of Hex -"FD" for an AC3-audio stream and a video-stream ID of Hex-"E0". While the "E0"-Id is also found in DVB-S2-satellite-AVC/H.264-transmissions, there Hex-"BD" is used as the audio-stream ID. I am not sure if this is a problem. The stream ID's can be set in the options fields of the muxer.

enjoyer
30th July 2007, 17:49
I guess it depends on the properties of your source. I am not sure what the limitations using the mainconcept muxer are, if they cannot multiplex MBAFF or PAFF containing video stream or what else causes a problem. One thing I have found out is that the mainconcept muxer by default assigns an audio-stream ID of Hex -"FD" for an AC3-audio stream and a video-stream ID of Hex-"E0". While the "E0"-Id is also found in DVB-S2-satellite-AVC/H.264-transmissions, there Hex-"BD" is used as the audio-stream ID. I am not sure if this is a problem. The stream ID's can be set in the options fields of the muxer.

You are not talking about the Elecard xmuxer or??? because I cant find a option field there....

Can you please give me a link to the *mainconcept muxer*? I dont find it :(

Schmendrick
31st July 2007, 08:49
I don't use the xmuxer, so it must be available somewhere in an options or properties field.

Actually the Mainconcept Muxer is a directshow filter and it is included within the Elecard Xmuxer package. If you have a close look into what Alkasar is linking to even without understanding french you might find what you are looking for.

Anyway I have found out that the Haali splitter eventhough its output pins connect to the input pins of the Mainconcept Muxer do not produce a ts-file. If a raw demuxed H264-video-file is open with the "File(asynch.)"-filter, then is connected to the Mainconcept (or Elecard) MPEG demultiplexer you will obtain a "AVC"-output-pin. This AVC-output-pin feeds a valid input to the Mainconcept Muxer. An AC3-file can be fed using the "ac3file.ax" filter. With the "Dump"-filter the desired ts-file then can be produced.

On the Mainconcept Muxer you have to right-click, then on filter-properties, then on "Main" and then on the "PES"-field of your already fed AC3-stream. Then in the right window you will find "Stream PES ID, sub_id" after double-clicking on to it you can change its value e.g. to "0xBD".
After having changed the "Stream PES ID, sub_id" to 189 (which is Hex BD), you have to connect the output to a "Dump"-filter which is contained within ths graphedit-package. When inserting the "Dump-filter" you have to set tha output file name e.g. Video.ts. Finally you click on the play button of graphedit and your H264- and AC3-files will be muxed into a ts-file.

enjoyer
31st July 2007, 11:58
I don't use the xmuxer, so it must be available somewhere in an options or properties field.

Actually the Mainconcept Muxer is a directshow filter and it is included within the Elecard Xmuxer package. If you have a close look into what Alkasar is linking to even without understanding french you might find what you are looking for.

Anyway I have found out that the Haali splitter eventhough its output pins connect to the input pins of the Mainconcept Muxer do not produce a ts-file. If a raw demuxed H264-video-file is open with the "File(asynch.)"-filter, then is connected to the Mainconcept (or Elecard) MPEG demultiplexer you will obtain a "AVC"-output-pin. This AVC-output-pin feeds a valid input to the Mainconcept Muxer. An AC3-file can be fed using the "ac3file.ax" filter. With the "Dump"-filter the desired ts-file then can be produced.

On the Mainconcept Muxer you have to right-click, then on filter-properties, then on "Main" and then on the "PES"-field of your already fed AC3-stream. Then in the right window you will find "Stream PES ID, sub_id" after double-clicking on to it you can change its value e.g. to "0xBD".
After having changed the "Stream PES ID, sub_id" to 189 (which is Hex BD), you have to connect the output to a "Dump"-filter which is contained within ths graphedit-package. When inserting the "Dump-filter" you have to set tha output file name e.g. Video.ts. Finally you click on the play button of graphedit and your H264- and AC3-files will be muxed into a ts-file.


Many thanks for your manual....but the file doesnt play fine in vlc and *tsremux* doesnt create a clipinf :((

enjoyer
2nd August 2007, 00:20
Ok...a method to remux mkv to ts without defects!!

1. extract your h264.mkv with MKVextractGUI and produce a *.h264 and *.ac3 file

2. insert the files in elcard xmuxer 2.2.70328 and create a h264.ts file!!

this files plays flawlessly in powerdvd..... :)

adonai
3rd August 2007, 06:02
I use mkvextractgui to break a mkv into the two files, however when adding them into the xmuxerpro it sais the file may be corrupt or unsupported, am I doing something wrong?

enjoyer
3rd August 2007, 22:07
I use mkvextractgui to break a mkv into the two files, however when adding them into the xmuxerpro it sais the file may be corrupt or unsupported, am I doing something wrong?

make sure that u have pro v2.2 or higher......

hekoheko
7th August 2007, 18:26
Well I have extracted mkv into *.h264 and cyberlinks H264 decoders DXVA still doesn't work properly, I have ATI RADEON HD2600XT.

Same problem, movie fps drops to 19fps.

ACrowley
11th August 2007, 12:12
well the VLC mkv to TS outputs a non compliant TS right ?

Perfect is Manzanita MP2TSME

AJ500
28th September 2007, 00:20
I don't use the xmuxer, so it must be available somewhere in an options or properties field.

....
Thanks for the advice on using GraphEdit! I've been trying various approaches and none were as good as yours. I already had all the DirectShow filters I needed.