PDA

View Full Version : h.264 in mpeg2-ts?


grayhalo
28th July 2005, 00:05
probably a total newb question, but could someone please explain to me how I would take a video I've encoded to h.264 in Quicktime Pro and make a mpeg2 transport stream out of it? Is there an easy way (a tool?) to do this. I've played with many tools that allow me to strip away the TS information but not many that allow encapsulation.. Maybe I'm way off base, someone help please :-).

Also, on a somewhat related note, where in your opinion is the best place to get information about the relationship between these different codecs and also hi-def stuff (ATSC, etc)...

puffpio
28th July 2005, 00:39
sounds kinda off base..trying to put an mpeg4 video stream into an mpeg2 transport stream? Is there a native mpeg4 transport stream?

nm
28th July 2005, 00:46
sounds kinda off base..trying to put an mpeg4 video stream into an mpeg2 transport stream?
Not at all: http://lists.mpegif.org/pipermail/mp4-tech/2004-September/004180.html
This is probably what they are going to use for HDTV here in Europe.

nm
28th July 2005, 01:07
probably a total newb question, but could someone please explain to me how I would take a video I've encoded to h.264 in Quicktime Pro and make a mpeg2 transport stream out of it? Is there an easy way (a tool?) to do this.
I haven't tried this myself, but VLC (http://www.videolan.org/) has support for streaming MPEG-4 AVC over network. They use MPEG TS format among others, so it could be possible to put AVC into it. If VLC doesn't allow you to directly save the stream to a file, you can use a separate instance to read the stream and dump it.

grayhalo
28th July 2005, 01:23
that is actually what i'm trying right now... will let you know how it works.

ChronoCross
28th July 2005, 02:28
I haven't tried this myself, but VLC (http://www.videolan.org/) has support for streaming MPEG-4 AVC over network. They use MPEG TS format among others, so it could be possible to put AVC into it. If VLC doesn't allow you to directly save the stream to a file, you can use a separate instance to read the stream and dump it.

As discussed in the ateme beta thread it may be possible with the next edition of the AVC encoder to do .ts. so look forward to that possibility

grayhalo
28th July 2005, 18:48
Well I re-encoded to h.264 in Quicktime Pro and have been messing around with VLC but can't seem to get it working quite right. Here's the command I'm trying to use:

VLC inputstream.mp4 --sout '#standard{access=file,mux=ts,url=output.ts}'

This creates a transport stream, but there doesn't seem to be any video content, just audio. Or maybe VLC just can't see/play the video? But it can play the mp4 just fine...

Any help would be appreciated. Also, a list of other good resources would be invaluable as well. Thanks!

Doom9
28th July 2005, 19:04
Current Moonlight tools can write AVC into a transport stream (and have done so for quite a while). The huge overhead as compared to the MP4 container was the main reason why the Moonlight/Elecard codec wasn't included in the codec comparison last December.

grayhalo
28th July 2005, 19:10
XMuxer pro gives me an unsupported format when I try loading it in...

b_x20852
29th July 2005, 15:35
I've played with many tools that allow me to strip away the TS information

Could you please advise what tools you tried, and which one was the best for the task?

I need something that will intercept the MPEG-2 TS over UDP/IP stream, recover AVC content, and write it in the file. I don't even need to play it - just write it in the file.

bond
8th August 2005, 13:57
VLC inputstream.mp4 --sout '#standard{access=file,mux=ts,url=output.ts}'

This creates a transport stream, but there doesn't seem to be any video content, just audio.i now tried placing avc in ts and ps myself with videolan with the following commandline:

vlc "C:\...\input.file" :sout=output.mpg

vlc "C:\...\input.file" :sout=output.tsmy findings:

1) no ps or ts file with avc created with vlc can be played by the mainconcept dshow filters, which should handle it.
i therefore assume that vlc is simply not able to create spec compliant avc in ps or ts files

2) i wasnt able to remux apple avc .mp4 files to .ts (only got a 0kb output), but .mp4 files muxed with mp4box worked (got a .ts with the correct filesize), maybe because of the slices apple uses?
still the output .ts doesnt play anywhere (tried mainconcept, vlc and mplayer)

3) i was able to remux avc in mp4 to .mpg, but it also doesnt play anywhere

4) i was able to remux avc in avi to .mpg and .ts and both play in mplayer, but none play in mainconcept or vlc

5) i wasnt able to remux raw avc (and also not raw .m2v) to ps and ts with vlc, as i always only got a 1kb output

i only tried some basic avc streams without b-frames, no slices

Or maybe VLC just can't see/play the video? But it can play the mp4 just fine... seems as if vlc isnt able at all to play any of the .mpg or .ts avc files it creates (but its able to play the mainconcept avc .ts files, but not the .mpg files)


moved to container forum

bond
8th August 2005, 19:04
ok i now tried my luck with ffmpeg and with that tool its possible to both encode and mux avc into mpeg-2 ts

encoding:
ffmpeg -i "C:\bla\input.bla" -vcodec h264 -f mpegts output.tsmuxing:
ffmpeg -f h264 -i "C:\bla\input.264" -vcodec copy -f mpegts output.tsthe output plays fine in mplayer and with the mainconcept filters, but i dunno at all if they are spec compliant
videolan seems to have some problems with the streams

unixfs
11th December 2005, 11:24
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).

bond
11th December 2005, 12:42
do you know if ffmpegs way of muxing avc to ts is spec compliant with the avc-in-mpg specs?

unixfs
11th December 2005, 15:10
when the AVC stream is in bytestream format it is, otherwise it's not.

Hyper Shinchan
16th December 2005, 18:17
Anyway can you write the command line to include AAC, AC3 or MPEG audio, Bond (or someone else)? I don't use FFMPEG and i'm not able to do it. Where can I find a good build of ffmpeg too (I've used the one included in 3GPP converter and it seems to work fine with TS muxing). I think that actually it's pretty stupid muxing AVC in TS, but it will be useful in the future, of course.

bond
16th December 2005, 18:34
i guess the chance is great that the way ffmpeg places avc in .ts and .mpg isnt spec compliant, so unless we know it is, i wouldnt use it

digigami
25th December 2005, 21:06
when the AVC stream is in bytestream format it is, otherwise it's not.

What about raw NAL to bytestream converters?

Also, anyone know which spec documents cover packaging H.264 in MPEG-2 transport streams?

unixfs
27th December 2005, 20:52
What about raw NAL to bytestream converters?
I'm not aware of any such tool
Also, anyone know which spec documents cover packaging H.264 in MPEG-2 transport streams?
recent revisions of IS13818-1