mpg-4 es video in a mpeg-2 ps

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
bschuele
New Cone
New Cone
Posts: 4
Joined: 04 Feb 2009 15:40
Operating System: Windows/Linux
Location: Switzerland

mpg-4 es video in a mpeg-2 ps

Postby bschuele » 04 Feb 2009 15:55

I have a file with mpeg-4 video and aac audio elementary streams in a mpeg-2 program stream (*.mpg)
The vlc player does not recognize the mp4 video elementary stream and the aac audio (es-stream).

It should read the program stream map especially the steam_type tag to determine the type of es.
(see http://www.atsc.org/standards/Code_Point_Registry.pdf page 14)

link to video: http://www.benjaminschuele.ch/video-m4- ... -m2-PS.mpg

With installed codecs the windows media player does play it.


any ideas?

debug output:

Code: Select all

main debug: starting new item main debug: processing request item video-m4-audio-aac-format-m2-PS.mpg node Wiedergabeliste skip 0 main debug: resyncing on video-m4-audio-aac-format-m2-PS.mpg main debug: video-m4-audio-aac-format-m2-PS.mpg is at 6 main debug: creating new input thread main debug: Creating an input for 'video-m4-audio-aac-format-m2-PS.mpg' main debug: waiting for thread initialization main debug: thread started main debug: thread 5552 (input) created at priority 1 (input/input.c:368) main debug: `H:\ORICS\video-m4-audio-aac-format-m2-PS.mpg' gives access `' demux `' path `H:\ORICS\video-m4-audio-aac-format-m2-PS.mpg' main debug: creating demux: access='' demux='' path='H:\ORICS\video-m4-audio-aac-format-m2-PS.mpg' qt4 debug: Updating the stream status: 3 main debug: looking for access_demux module: 1 candidate main debug: TIMER module_Need() : 7.000 ms - Total 7.000 ms / 1 intvls (Avg 7.000 ms) main debug: creating access '' path='H:\ORICS\video-m4-audio-aac-format-m2-PS.mpg' main debug: looking for access module: 5 candidates vcd debug: trying .cue file: H:\ORICS\video-m4-audio-aac-format-m2-PS.cue vcd debug: could not find .cue file qt4 debug: New Event: type 1103 qt4 debug: Updating the stream status: 1 access_file debug: opening file `H:\ORICS\video-m4-audio-aac-format-m2-PS.mpg' main debug: using access module "access_file" main debug: TIMER module_Need() : 7.000 ms - Total 7.000 ms / 1 intvls (Avg 7.000 ms) qt4 debug: New Event: type 1103 qt4 debug: Updating the stream status: 2 main debug: Using AStream*Stream main debug: pre-buffering... main debug: received first data for our buffer main debug: pre-buffering done 1408981 bytes in 0s - 49139 kbytes/s main debug: creating demux: access='' demux='' path='H:\ORICS\video-m4-audio-aac-format-m2-PS.mpg' main debug: looking for demux module: 51 candidates main debug: using demux module "ps" main debug: TIMER module_Need() : 1.000 ms - Total 1.000 ms / 1 intvls (Avg 1.000 ms) main debug: looking for a subtitle file in H:\ORICS\ main debug: `H:\ORICS\video-m4-audio-aac-format-m2-PS.mpg' successfully opened qt4 debug: New Event: type 1103 qt4 debug: Updating the stream status: 3 ps debug: we found a length of: 8609166 ps debug: we found a length of: 95766300 main debug: control type=1 main debug: selecting program id=0 main debug: looking for decoder module: 35 candidates main debug: using decoder module "libmpeg2" main debug: TIMER module_Need() : 1.000 ms - Total 1.000 ms / 1 intvls (Avg 1.000 ms) main debug: thread 6228 (decoder) created at priority 0 (input/decoder.c:217) main debug: thread started main debug: looking for decoder module: 35 candidates main debug: using decoder module "mpeg_audio" main debug: TIMER module_Need() : 0.000 ms - Total 0.000 ms / 1 intvls (Avg 0.000 ms) main debug: thread 6264 (decoder) created at priority 2 (input/decoder.c:217) main debug: thread started

fenrir
Blank Cone
Blank Cone
Posts: 45
Joined: 09 Mar 2004 21:45

Re: mpg-4 es video in a mpeg-2 ps

Postby fenrir » 05 Feb 2009 20:14

Hi,

Do you have more information on the file ? What tool created it ?

I have looked at it. It seems bad formated to me: the "System Header is incomplete" and so hide the PSM that is behind it.

A hex dump gives:

[1] 00 00 01 BA 5E 0B EE 3F 94 01 00 A3 D7 F8
[2] 00 00 01 BB 00 06
[3] 00 00 01 BC 00 13 E1 FF 00 00 00 10 10 C0 00 03 1B 01 F5 11 C0 00 03 1C 01 00 81 BF 3D 5D
[4] 00 00 01 E0 ....

[1] Is the pack header.
[2] Is the beginning of the "System Header" BUT the payload is missing (6 bytes).
[3] Is the "PSM" but VLC does not see it as it is taken as the System Header payload. You can also see that the size advertised by the header is shorter than the payload by 5 bytes. (Maybe a mix up in the generation tool ?)
[4] Is the first video packet.

bschuele
New Cone
New Cone
Posts: 4
Joined: 04 Feb 2009 15:40
Operating System: Windows/Linux
Location: Switzerland

Re: mpg-4 es video in a mpeg-2 ps

Postby bschuele » 12 Feb 2009 10:37

Hi,

the file is from a self written muxer, taking a mpg-2 ts (from network) and mux it to ps.

you are right, the header was incorrect. I correct it and in the messages the vlc see the PSM now, but still use libmpeg2 and mpeg_audio instead of mpeg-4 video and aac audio.

new file: http://www.benjaminschuele.ch/video-m4- ... 2-PS-2.mpg

Code: Select all

main debug: starting new item main debug: processing request item video-m4-audio-aac-format-m2-PS-2.mpg node Wiedergabeliste skip 0 main debug: resyncing on video-m4-audio-aac-format-m2-PS-2.mpg main debug: video-m4-audio-aac-format-m2-PS-2.mpg is at 4 main debug: creating new input thread main debug: Creating an input for 'video-m4-audio-aac-format-m2-PS-2.mpg' main debug: waiting for thread initialization main debug: thread started main debug: thread 5676 (input) created at priority 1 (input/input.c:368) qt4 debug: Updating the stream status: 3 main debug: `H:\ORICS\video-m4-audio-aac-format-m2-PS-2.mpg' gives access `' demux `' path `H:\ORICS\video-m4-audio-aac-format-m2-PS-2.mpg' main debug: creating demux: access='' demux='' path='H:\ORICS\video-m4-audio-aac-format-m2-PS-2.mpg' main debug: looking for access_demux module: 1 candidate main debug: TIMER module_Need() : 4.000 ms - Total 4.000 ms / 1 intvls (Avg 4.000 ms) main debug: creating access '' path='H:\ORICS\video-m4-audio-aac-format-m2-PS-2.mpg' main debug: looking for access module: 5 candidates vcd debug: trying .cue file: H:\ORICS\video-m4-audio-aac-format-m2-PS-2.cue qt4 debug: New Event: type 1103 qt4 debug: Updating the stream status: 1 vcd debug: could not find .cue file access_file debug: opening file `H:\ORICS\video-m4-audio-aac-format-m2-PS-2.mpg' main debug: using access module "access_file" main debug: TIMER module_Need() : 7.000 ms - Total 7.000 ms / 1 intvls (Avg 7.000 ms) qt4 debug: New Event: type 1103 qt4 debug: Updating the stream status: 2 main debug: Using AStream*Stream main debug: pre-buffering... main debug: received first data for our buffer main debug: pre-buffering done 1408981 bytes in 0s - 275136 kbytes/s main debug: creating demux: access='' demux='' path='H:\ORICS\video-m4-audio-aac-format-m2-PS-2.mpg' main debug: looking for demux module: 51 candidates main debug: using demux module "ps" main debug: TIMER module_Need() : 0.000 ms - Total 0.000 ms / 1 intvls (Avg 0.000 ms) main debug: looking for a subtitle file in H:\ORICS\ main debug: `H:\ORICS\video-m4-audio-aac-format-m2-PS-2.mpg' successfully opened ps warning: garbage at input, trying to resync... ps warning: found sync code ps debug: we found a length of: 9490989 ps debug: we found a length of: 3234941133 main debug: control type=1 ps debug: contains a PSM main debug: selecting program id=0 main debug: looking for decoder module: 35 candidates main debug: using decoder module "libmpeg2" main debug: TIMER module_Need() : 0.000 ms - Total 0.000 ms / 1 intvls (Avg 0.000 ms) main debug: thread 5892 (decoder) created at priority 0 (input/decoder.c:217) main debug: thread started main debug: looking for decoder module: 35 candidates main debug: using decoder module "mpeg_audio" main debug: TIMER module_Need() : 0.000 ms - Total 0.000 ms / 1 intvls (Avg 0.000 ms) main debug: thread 5840 (decoder) created at priority 2 (input/decoder.c:217) main debug: thread started mpeg_audio debug: emulated startcode mpeg_audio debug: emulated startcode (no startcode on following frame) mpeg_audio debug: emulated startcode

fenrir
Blank Cone
Blank Cone
Posts: 45
Joined: 09 Mar 2004 21:45

Re: mpg-4 es video in a mpeg-2 ps

Postby fenrir » 12 Feb 2009 20:24

Your PSM is invalid. The ID used for the video and audio track are the same whereas they should be
0xc0 + audio_index for audio
0xe0 + audio_index for video
I would advise you to find the ISO/IEC 13818-1 to help you create valid PS.

Now, for the audio, I see that you use stream_type 0x11, is it really AAC LATM that you are using ?
If so, our current PS demuxer does not support it. If you have a valid sample, I will add support for it.

bschuele
New Cone
New Cone
Posts: 4
Joined: 04 Feb 2009 15:40
Operating System: Windows/Linux
Location: Switzerland

Re: mpg-4 es video in a mpeg-2 ps

Postby bschuele » 16 Feb 2009 10:24

Thanks, this was a copy+paste error and I have corrected it.

new file: http://www.benjaminschuele.ch/video-m4- ... 2-PS-3.mpg

Yes, the audio is really AAC.

Thanks a lot for you help

fenrir
Blank Cone
Blank Cone
Posts: 45
Joined: 09 Mar 2004 21:45

Re: mpg-4 es video in a mpeg-2 ps

Postby fenrir » 16 Feb 2009 19:51

Unless I am wrong you are using AAC encapsulated into ADTS and not into LATM.
For ADTS you must use 0x0f as stream type instead of 0x11.
Now you must be careful because you can only use MPEG-II AAC with ADTS in a PS or TS stream. If you want to have MPEG-4 AAC you must use LATM encapsulation which is a bit more complicated.

bschuele
New Cone
New Cone
Posts: 4
Joined: 04 Feb 2009 15:40
Operating System: Windows/Linux
Location: Switzerland

Re: mpg-4 es video in a mpeg-2 ps

Postby bschuele » 17 Feb 2009 08:38

again, thanks a lot for your competent hints!
yes it is ADTS frametype.

It is new for me that MPEG-4 AAC have to use LATM. Do you now where in the ISO is it written?

The easer solution for me is to change aac encoder to mpeg-2:
Then it's clear that I have to use stream type 0x0f.
The book video demystified (4th) on page 666 say to stream type 0x0f: MPEG-2 Part 7 audio

http://www.benjaminschuele.ch/video-m4- ... 2-PS-4.mpg

fenrir
Blank Cone
Blank Cone
Posts: 45
Joined: 09 Mar 2004 21:45

Re: mpg-4 es video in a mpeg-2 ps

Postby fenrir » 17 Feb 2009 22:39

You put only one pack header in the entire file. That is not valid.

An extract of ISO/IEC 13818-1 says:
"The Program Stream shall be constructed such that the time interval between the bytes containing the last bit of
system_clock_reference_base fields in successive packs shall be less than or equal to 0.7 s"

Moreover you must construct the pack header such that the SCR respect the P-STD model as described in this document.


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 9 guests