Log in

View Full Version : Looking for MP4 samples


Pages : [1] 2

Guest
16th October 2012, 05:40
I'm adding MP4 container support to DGDecNV and need samples containing all 3 video types: AVC, MPEG2, and VC1. Any pointers will be gratefully received. Thank you.

JEEB
17th October 2012, 13:33
I'm adding MP4 container support to DGDecNV and need samples containing all 3 video types: AVC, MPEG2, and VC1. Any pointers will be gratefully received. Thank you.

Seems like Chiariglione (http://mpeg.chiariglione.org/technologies/mpeg-4/mp04-conf/index.htm) has links to some ISO conformance bitstreams. Also I recommend taking a look at the L-SMASH (http://code.google.com/p/l-smash/) demuxer/muxer libraries/applications for an implementation that has a nice software license, and capable of creating various samples :)

Guest
17th October 2012, 13:59
Thank you, JEEB!

SeeMoreDigital
17th October 2012, 16:12
I've just generated the following for you: -

AVC@200Kbps+6Ch_AAC-HE@96Kbps.MP4
AVC@200Kbps+6Ch_AC3@448Kbps.MP4
MPEG-2@3700Kbps+6Ch_AAC-HE@96Kbps.MP4

Here's the link (http://www.sendspace.com/file/qxk8lw).

I have not got any VC-1 in .MP4 samples. If you find some please let me know?


Cheers

LoRd_MuldeR
17th October 2012, 16:46
Does MP4 properly support VC-1 at all?

AFAIK, MP4 is designed for certain stream formats only. Video formats include MPEG-2, MPEG-4 Part-2 (aka "ASP") and MPEG-4 Part-10 (aka "AVC/H.264").

But I don't think "VC-1" is supported officially. Sure, you can put VC-1 into MP4 as a "private stream", but is this commonly done and is there a "specification" on how to do it exactly?

JEEB
17th October 2012, 17:02
Does MP4 properly support VC-1 at all?

But I don't think "VC-1" is supported officially. Sure, you can put VC-1 into MP4 as a "private stream", but is this commonly done and is there a "specification" on how to do it exactly?
Yes, there is a specification on VC-1 in "MP4". One of the L-SMASH project members used his money to buy it, too, in order to implement it :P

The L-SMASH implementation based on the specification can be found here (http://code.google.com/p/l-smash/source/browse/vc1.c).

Edit: The full name of the specification is "SMPTE RP 2025:2007 VC-1 Bitstream Storage in the ISO Base Media File"

SeeMoreDigital
17th October 2012, 17:02
Well, here's what the gods at Microsoft have to say: -

"VC-1 video encoded for file-based playback commonly uses the Microsoft Advanced Systems Format (ASF) file container as part of the Windows Media ecosystem, but VC-1 has also been standardized for storage in industry-recognized MP4 and MXF (Material eXchange Format) file containers."

Link to source: http://www.microsoft.com/windows/windowsmedia/howto/articles/vc1techoverview.aspx#VC1Adoption


Cheers

JEEB
17th October 2012, 18:21
As was pointed on the L-SMASH IRC channel, 14496-4:2004 Amd.24 and Amd.37 seem to be official samples as well. Available here (http://standards.iso.org/ittf/PubliclyAvailableStandards/index.html).

SeeMoreDigital
17th October 2012, 18:31
As was pointed on the L-SMASH IRC channel, 14496-4:2004 Amd.24 and Amd.37 seem to be official samples as well. Available here (http://standards.iso.org/ittf/PubliclyAvailableStandards/index.html).
I can't find any VC-1 in .MP4 samples on that web site...

JEEB
17th October 2012, 18:52
I can't find any VC-1 in .MP4 samples on that web site...
I am just linking the "MP4" Conformance bit streams available from various outlets in order to have things to test conformance to the format with :P

I am not sure if SMPTE releases samples, so one of the only ways of creating such VC-1-in-"MP4" samples is to use the muxer from L-SMASH (GPAC then later added support as well, but I'm not sure if the implementation is the same). You can grab a VC-1 sample from, say, the ffmpeg/libav FATE sample libraries and mux it into "MP4" with the muxer binary.

P.S. The reason I use the notation "MP4" is because the whole thing is a mess created between the ISO Media Container, the MPEG-4 container format(s), official mappings of formats within one of those, and extra definitions in various brands of "MP4" administered by the mp4ra organization.

VFR maniac
17th October 2012, 18:57
AFAIK, there is no official VC-1 and MPEG-1/2 Video in ISO Base Media samples.
And, I have never seen the specification of encapsulation of MPEG-1/2 Video in "MP4".
There is ObjectTypeIndication of MPEG-1/2 Video but the definition of encapsulation of MPEG-1/2 Video is absent.
So, as far as I understand, though GPAC supports encapsulation of MPEG-1/2 Video in MP4, MPEG-1/2 Video in MP4 shall not be present.

There are many CODECs listed in ObjectTypeIndication, but some CODEC are not defined about its encapsulation for "MP4" container such as MPEG-1/2 Video, VC-1, DTS audio, (enhanced) AC-3 etc...

SeeMoreDigital
17th October 2012, 19:38
Well...

If anybody is interested in an MPEG-1+AAC.MP4 sample. Here you go (http://www.sendspace.com/file/2x198e).


Cheers

Guest
18th October 2012, 01:15
Thanks, guys. I really appreciate your help.

Things are looking good. This shows that my parsing is working. Still have lots to do but it's all systems GO!

sneaker_ger
18th October 2012, 05:37
VC-1 sample:
http://www.mediafire.com/?g4922oixxbfmia1

Guest
18th October 2012, 06:16
Sweet, thank you.

Guest
18th October 2012, 15:16
Guys, I've run into something strange and I'm hoping you can enlighten me.

So I open an MP4 file from a camcorder with 29.97 fps. I get timescale of 30000 and sample delta of 1001. Wonderful! The sample duration is 1001/30000 = 33.3ms as expected for 29.97 fps.

Now I open another sample with 50 fps. I get timescale 600 and sample delta 1. Whoa?! What is going on here? The sample duration is 1/600 = 1.66 ms. That's way off for 50 fps. Yet it plays properly in players. What am I missing to get the correct sample duration?

Guest
18th October 2012, 15:26
Looks like the answer is here:

http://forum.doom9.org/showthread.php?p=1584023#post1584023

OK, I have media timescale 600 and track timescale 50. So using the track timescale gives me what I need. Now I am curious about the significance of the media timescale.

VFR maniac
18th October 2012, 17:33
ISO Base Media and MOV file format has two timescale.
One is "movie" timescale; this is used for whole presentation.
Another is "media" timescale; this is used per the media in a track.

All track use "movie" or "presentation" timescale.
ISO Base Media and MOV file format distinguish media layer and track/movie/presentation layer clearly.
Basically, media timescales are used in atoms placed below mdia atom.

Track can be rewritten as what users want to do, while media shall not be touched by users.
Parameters in media layer shall be decided when the media was created.

Why is there two timescale?
Because if two or more media timescale is different in a movie, timestamp handling by the container side will be mess.
(e.g. interactive features between tracks in a movie.)
So, movie timescale is used for comprehensive purpose of timestamp handling.

Track can handle presentation time outside of media, and can construct complicated presentation easily by edit list.
Each entry in edit list can pick an arbitray portion of media.
And by concatenating edits, the presentation timeline of a track is built.
This is the reason composition time != presentation time.
Anyway, edit list is used for A/V sync basically.
Note: edits don't restrict decoding, only restrict presentation.
So, even if an edit doesn't include random access point, the player shall decode from the sample that is the closest random access point
and display or make a sound from decoded samples included in that edit.

SeeMoreDigital
18th October 2012, 20:29
Note: edits don't restrict decoding, only restrict presentation. So, even if an edit doesn't include random access point, the player shall decode from the sample that is the closest random access point and display or make a sound from decoded samples included in that edit.
Am I correct in thinking that currently the only media player that makes use of this presentation data is Apples QuickTime player!

So far it's the only player I've found that lets you add and edit the following: -

http://i46.tinypic.com/21o5wza.png


Cheers

Guest
19th October 2012, 04:46
Thank you, VFR maniac, for the detailed account of the MP4 container. It's interesting to see the differences between MP4 and MKV.

filler56789
19th October 2012, 21:30
<SNIP>

I am not sure if SMPTE releases samples, so one of the only ways of creating such VC-1-in-"MP4" samples is to use the muxer from L-SMASH (GPAC then later added support as well, but I'm not sure if the implementation is the same).

BTW, is there any MP4Box.exe compiled with VC-1 (and/or DTS) support?

According to the page indicated below, the answer apparently is "NO" :-(

http://sourceforge.net/projects/gpac/forums/forum/287546/topic/4983525

VFR maniac
19th October 2012, 21:42
GPAC doesn't support importing VC-1 and DTS stream.
I don't know whether GPAC can remux VC-1 and DTS stream or not.

Selur
20th October 2012, 08:38
btw. is there a cli tools like mp4box for L-Smash ?

sneaker_ger
20th October 2012, 09:18
http://www.mediafire.com/?9l2u6z4s3i9zu

/edit:
Oh, and in case the devs are reading this:
--optimize-pd is broken (again) in the latest revisions. Crashes and leaves a b0rked file.

JEEB
20th October 2012, 14:36
/edit:
Oh, and in case the devs are reading this:
--optimize-pd is broken (again) in the latest revisions. Crashes and leaves a b0rked file.
I had noticed this bug some time ago and posted backtraces, and while it didn't even come up on all architectures (linux, gcc 4.6.3 even under valgrind worked seemingly just fine), and worked just fine without optimizations on all architectures it seems, it seems to have been a quite old bug from more than a year ago :)

It is fixed now in the git repository, and you can grab a fixed tool package for Windows from here (http://x264.fushizen.eu/builds/l-smash/l-smash_tools_r697_215d271.7z).

Guest
20th October 2012, 21:13
Can anyone tell me how to get the number of channels for an audio track from the MP4 file? Thank you.

sneaker_ger
20th October 2012, 22:20
I had noticed this bug some time ago and posted backtraces, and while it didn't even come up on all architectures (linux, gcc 4.6.3 even under valgrind worked seemingly just fine), and worked just fine without optimizations on all architectures it seems, it seems to have been a quite old bug from more than a year ago :)

It is fixed now in the git repository, and you can grab a fixed tool package for Windows from here (http://x264.fushizen.eu/builds/l-smash/l-smash_tools_r697_215d271.7z).

Working fine now, thx.

VFR maniac
20th October 2012, 23:49
Can anyone tell me how to get the number of channels for an audio track from the MP4 file? Thank you.

You may need to decode the decoder specific info in the corresponding sample description entry.
There are some CODECs whose 'channelcount' and 'samplerate' fields shall be ignored.
Be careful about 'template' fields.

Guest
20th October 2012, 23:55
That's what I discovered too. This returned the right count for some of my 2-channel streams but for the 6-channel stream posted by SeeMoreDigital, it returned a large negative number.

unsigned __int64 chans;
MP4GetTrackIntegerProperty(mp4File, trackId, "mdia.minf.stbl.stsd.mp4a.channels", &chans);

Can you point me to some LSMASH that code does it correctly?

SeeMoreDigital
21st October 2012, 10:32
If you require the 6Ch AAC-HE.mp4 'audio only' stream. Here it is! (http://www.sendspace.com/file/7liwtk)

It was generated from an 6Ch AC3 stream using LameXP (version 4.05 Final−1, Build 1100). Which directly muxes AAC streams into the .MP4 container...

VFR maniac
21st October 2012, 10:33
That's what I discovered too. This returned the right count for some of my 2-channel streams but for the 6-channel stream posted by SeeMoreDigital, it returned a large negative number.

unsigned __int64 chans;
MP4GetTrackIntegerProperty(mp4File, trackId, "mdia.minf.stbl.stsd.mp4a.channels", &chans);

Can you point me to some LSMASH that code does it correctly?

Of what CODEC do you want the number of channels?
It is CODEC-dependent matter.

If you want of MPEG-4 Audio with your parser, you shall extract channelConfiguration of AudioSpecificConfig from esds atom at the first, and convert it into the number of channels.
It is already domains of MPEG-4 System (14496-1), MPEG-4 Audio (14496-3) and MP4 file format (14496-14), and NOT ISO Base Media (14496-12).
esds atom consists of an ES Descriptor and it is coded and packed with the way of MPEG-4 system.
Descriptors defined in MPEG-4 system start at 'tag' (1 byte) and field length (variable length coded) and the actual data follows them.

http://repo.or.cz/w/L-SMASH.git/blob/HEAD:/mp4sys.c#l970
http://repo.or.cz/w/L-SMASH.git/blob/HEAD:/mp4a.c#l580
http://repo.or.cz/w/L-SMASH.git/blob/HEAD:/mp4a.c#l631

SeeMoreDigital
21st October 2012, 11:28
If you require the 6Ch AAC-HE.mp4 'audio only' stream. Here it is! (http://www.sendspace.com/file/7liwtk)

It was generated from an 6Ch AC3 stream using LameXP (version 4.05 Final−1, Build 1100). Which directly muxes AAC streams into the .MP4 container...
If anybody is interested. Here's the same 6Ch AAC-HE.mp4 'audio only' file, re-muxed into the .MOV container (http://www.sendspace.com/file/hbj1bx) using QuickTime Player Pro 7.7.2 (1680.56).

As you guys may already know, QuickTime Player Pro offers you the ability to change how the .MOV file will play in QuickTime player, such the volume, balance, bass and treble levels. And it also allows you to re-map the channel assignments!

http://i47.tinypic.com/24oddz4.png

My question is, does the MP4 container allow the same level of functionality?


Cheers

Guest
21st October 2012, 13:13
Of what CODEC do you want the number of channels? Any of them that I might reasonably encounter in an MP4 file, of course.

http://repo.or.cz/w/L-SMASH.git/blob/HEAD:/mp4sys.c#l970
http://repo.or.cz/w/L-SMASH.git/blob/HEAD:/mp4a.c#l580
http://repo.or.cz/w/L-SMASH.git/blob/HEAD:/mp4a.c#l631 What are the #numbers at the end? I browsed your respository and they don't seem to be line numbers as the files do not have that many lines.

And what is L-Smash-Works?

Guest
21st October 2012, 13:18
Somebody, SMD?, gave me a dump.txt file but I don't see the post anymore. :confused:

Anyway, my question is how did you create that box dump?

sneaker_ger
21st October 2012, 13:18
It's the letter "l", not the number "1".
Line 970
Line 580
Line 631
They should serve as HTML anchors, so your browser should scroll to the correct line by itself.

The dump was from me. I deleted it because it wasn't as easy as I thought and VFR maniac and others gave way better answers.
The dump was created with boxdumper.exe from the l-smash stand-alone package. (see link above)

Guest
21st October 2012, 13:18
It's the letter "l", not the number "1".
Line 970
Line 580
Line 631 Duh. :o

VFR maniac
21st October 2012, 13:18
If anybody is interested. Here's the same 6Ch AAC-HE.mp4 'audio only' file, re-muxed into the .MOV container (http://www.sendspace.com/file/hbj1bx) using QuickTime Player Pro 7.7.2 (1680.56).

As you guys may already know, QuickTime Player Pro offers you the ability to change how the .MOV file will play in QuickTime player, such the volume, balance, bass and treble levels. And it also allows you to re-map the channel assignments!

http://i47.tinypic.com/24oddz4.png

My question is, does the MP4 container allow the same level of functionality?


Cheers

Compositions and presentations of pure MP4 file format shall be through Object Descriptor (OD) and BIFS.
And, OD+BIFS can handle more complicated composition than one of MOV.

MP4 file format is based on ISO Base Media file format that has inherited MOV file format at many points.
So, you would think MP4 file also can use the same fields.
BUT, as I mentioned above, when a player read a file as a pure MP4, that player shall ignore them and use OD+BIFS instead for its compositions.

I can say there is no software, except for GPAC's player Osmo4, that support composition of pure MP4 file since it is so complicated and hard to implement.

This is the reason people doesn't use pure MP4 and use Apple's MP4 (M4A, M4V, etc...) instead.
AFAIK Apple's MP4 supports the same function as these of MOV.

SeeMoreDigital
21st October 2012, 13:40
I can say there is no software, except for GPAC's player Osmo4, that support composition of pure MP4 file since it is so complicated and hard to implement.Oh yes, Osmo4 player. That takes me back... I remember doing some basic menu navigation tests with some .MP4 files bond (http://forum.doom9.org/member.php?u=1626) created many years ago!

Personally, I think it's a real shame menu navigation never got supported in hardware players!

This is the reason people doesn't use pure MP4 and use Apple's MP4 (M4A, M4V, etc...) instead.Indeed, none of my hardware players support playback of AAC.MP4 files any more. They all favour AAC.M4A nowadays - Which I don't like!

AFAIK Apple's MP4 supports the same function as these of MOV.Thanks for that...

VFR maniac
21st October 2012, 13:43
Any of them that I might reasonably encounter in an MP4 file, of course.

There is no general way to get the actual number of channels used in any CODEC.

And what is L-Smash-Works?

L-SMASH Works is a project placed outside of L-SMASH project.
This project shares and provides examples of how to use L-SMASH library to projects outside of L-SMASH.
Currently, AviUtl's and Avisynth's plugins are available.
These input plugins also work audio pre-roll and video intra-refresh when seeking for MP4/MOV files if the files are set stream access info appropriately.

SeeMoreDigital
21st October 2012, 14:04
There is no general way to get the actual number of channels used in any CODEC.
With that in mind...

Donald, would you like an 7.1 (8) channel AAC in .MP4 file?

Guest
21st October 2012, 14:16
Is there a Windows build of L-Smash (not mingw and all that silliness, just a simple Visual Studio project)?

Guest
21st October 2012, 14:16
With that in mind...

Donald, would you like an 7.1 (8) channel AAC in .MP4 file? Sure. Thanks.

VFR maniac
21st October 2012, 14:23
Is there a Windows build of L-Smash (not mingw and all that silliness, just a simple Visual Studio project)?

L-SMASH is written in C99.
So, Visual Studio cannot compile L-SMASH. Sorry.

SeeMoreDigital
21st October 2012, 15:10
With that in mind...

Donald, would you like an 7.1 (8) channel AAC in .MP4 file?
Sure. Thanks.
here you go (http://www.sendspace.com/file/9d68wx)...

Guest
21st October 2012, 18:27
Thanks, SMD.

OK, I found the channels count for the AAC stream here:

mdia.minf.stbl.stsd.*[0].esds.decConfigDescr.decSpecificInfo[0].info

Where do I find it for AC3?

VFR maniac
22nd October 2012, 03:14
Where do I find it for AC3?

http://www.etsi.org/deliver/etsi_ts/102300_102399/102366/01.02.01_60/ts_102366v010201p.pdf
ETSI TS 102 366 V1.2.1 (2008-08) Annex F defines the encapsulation of (Enhanced) AC-3 in ISO Base Media.
Note that, for Enhanced AC-3, a typo is there.
wrong: for(i = 0; i < num_ind_sub; i++)
correct: for(i = 0; i <= num_ind_sub; i++)
You can get the number of channels from acmod and lfeon for AC-3.
See "Table 4.3: Audio coding mode" about acmod.
For Enhanced AC-3, you shall also consult with chan_loc if dependent substreams are present and your decoder can decode them.

ETSI TS 102 366 V1.2.1 (2008-08) Annex F is for ISO Base Media, not for MOV.
(Enhanced) AC-3 in MOV is encapsulated with different undocumented format.

Guest
22nd October 2012, 13:45
Thank you!

filler56789
22nd October 2012, 17:08
There is ObjectTypeIndication of MPEG-1/2 Video but the definition of encapsulation of MPEG-1/2 Video is absent.
So, as far as I understand, though GPAC supports encapsulation of MPEG-1/2 Video in MP4, MPEG-1/2 Video in MP4 shall not be present.

There are many CODECs listed in ObjectTypeIndication, but some CODEC are not defined about its encapsulation for "MP4" container such as MPEG-1/2 Video, VC-1, DTS audio, (enhanced) AC-3 etc...

So, is that the reason why L-Smash cannot import MPEG-4 ASP (a.k.a. DivX / Xvid) ? :confused:

Guest
22nd October 2012, 17:23
The dump was from me. I deleted it because it wasn't as easy as I thought and VFR maniac and others gave way better answers.
The dump was created with boxdumper.exe from the l-smash stand-alone package. (see link above) Thanks a lot for that. It is a very useful tool.

VFR maniac
22nd October 2012, 18:10
So, is that the reason why L-Smash cannot import MPEG-4 ASP (a.k.a. DivX / Xvid) ? :confused:

No, encapsulation of MPEG-4 Video in MP4 is defined in 14496-2 Annex K.

It is just laziness of me.
L-SMASH doesn't have enough man powers.
Originally, written by me and another person, but he was almost retired because of busyness and has been in a cardboard box.
Currently, large parts of the codes are written by me.
Others in L-SMASH project are working as tester.
We welcome a new developer :)