Log in

View Full Version : MediaInfo(Lib) 0.7 - Reading information about media files


Pages : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 [17] 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34

Zenitram
16th September 2010, 20:02
edit: the mediainfo builds on SF are dated 2010-09-15. do they contain the fix?

It does, but I just released a specific archive 20100916 with the latest version of the x64 DLL.

Note: do not edit a post for adding a question, I receive no alert with edits.

Sharktooth
16th September 2010, 20:05
ok and ok :)

LoRd_MuldeR
16th September 2010, 21:08
the x64 version lib doesnt work on all machines, or at least it crashes on some PCs.

Any details? I just made a plain "x64" build with MSVC 9.0 and "Enable enhanced instruction set" set to "Not set" :confused:

[EDIT]

Does anybody know if the "Generate intrinsic functions (/Oi)" option does effect CPU compatibility?

If I look at the MSDN documentation, I see no indication of that:
http://msdn.microsoft.com/en-us/library/f99tchzc(v=VS.90).aspx

Sharktooth
17th September 2010, 01:10
the problem is described here: http://forum.doom9.org/showthread.php?p=1442978#post1442978

Russian-Israelian
13th October 2010, 15:47
Zenitram - You'll be very kind if one day you put some simple ID3 tag editing in to MediaInfo for mp3/wma/ogg/mpa and for some of video containers. Thats not only my wish, but as well as many others. Atak_Snajpera says its possible...

Zenitram
13th October 2010, 15:50
Zenitram - You'll be very kind if one day you put some simple ID3 tag editing in to MediaInfo for mp3/wma/ogg/mpa and for some of video containers.

This is on a very far ToDo list.

Thats not only my wish, but as well as many others. Atak_Snajpera says its possible...

All is possible, the only question is if you have enought time to implement it or enough money to pay someone to do it...
Currently, I have more than enough to do with reading, and a business model, and I have no business model for writing, so not a priority for me.

Kurtnoise
13th October 2010, 15:55
@Jérôme : why are you removing PS/HE AAC detection from the aac parsing ?

Zenitram
13th October 2010, 16:01
@Jérôme : why are you removing PS/HE AAC detection from the aac parsing ?

Too many false-positives / complains about it, this was not a good idea with all cell phones today: lot of files are at 24 KHz and/or mono, without SBR and/or PS now, e.g. no possibility to differenciate real 24 KHz / mono from HE-AACv2 without explicit information.
So now I display SBR and PS only if the header has an explicit information in the AudioSpecificConfig. Implicit SBR/PS will be detected when I implement a more complete raw AAC parser (I have a sponsor for this, but he continues to postpone the feature, he wants other features before this one)

Kurtnoise
14th October 2010, 10:45
How much do you need to rewrite the aac parser ? :D

well...I understand but this breaks several current tools that uses this info. :(

Zenitram
14th October 2010, 10:50
How much do you need to rewrite the aac parser ? :D

Thousands of $ ;-)
But already sponsored, just a problem of time.

well...I understand but this breaks several current tools that uses this info. :(

Theses tools would be broken in all cases with wrong info for other files without PS/SBR. I understand this is a problem, but I remove it from the official version for correcting otehr problems from other software. I could add it again but deactivated by defaut (you set a #define), and you know this may be wrong for some other files.

war59312
16th October 2010, 19:50
Anyone have any vb code to parse the fps of a given file using mediainfo ?

Update: OK making progress..

Private Function GetFPS(ByVal s As String, ByVal mkvfile As String) As String
Dim orig As String = s
Dim t As String

t = "Frame rate"
s = syncedString

s = s.Substring(s.IndexOf(t) + t.Length)
s = s.Substring(s.IndexOf(": ") + 2)
s = s.Substring(0, s.IndexOf(vbNewLine))

Dim fps As Double = ExtractNumbers(s)

'Return s.Contains(t)

Return fps

End Function

Shared Function ExtractNumbers(ByVal expr As String) As String
Return String.Join(Nothing, System.Text.RegularExpressions.Regex.Split(expr, "[^\d]"))
End Function

Got that at http://dotnetslackers.com/Regex/re-35412_How_to_extract_numbers_from_string.aspx .

So for example if I run that on a video that has a 23.976fps I get back 23976.

BTW the original string would be "23.976 fps" before ExtractNumbers does its thing.

So yeah all I am trying to do is loose the fps. I'm newbie so learning by trying.

So now just to have the decimal back in the right place? Any ideas?

Update 2:

Easy fix.. Thinking too much. ;)

fps = s.Replace(" fps", "") That gets rid of the fps. Problem solved. Whooo!!!

New build of XenonMKV coming soon. :D

Zenitram
16th October 2010, 19:58
Anyone have any vb code to parse the fps of a given file using mediainfo ?

http://mediainfo.svn.sourceforge.net/viewvc/mediainfo/MediaInfoLib/trunk/Source/Example/HowToUse_Dll.cs?view=markup

+ MI.Get(StreamKind.Video, 0, "FrameRate"); //For the first video stream of the file

LoRd_MuldeR
5th November 2010, 01:59
Zenitram,

I'm currently re-writing LameXP from the scratch, based on the Qt Framwork. And this time proper Unicode support has high priority for me ;)

Unfortunately I noticed that an unpatched MediaInfo CLI doesn't output Unicode characters to STDOUT properly. And a quick look at the code turned out why that is:

inline void STRINGOUT(ZenLib::Ztring Text)
{
#ifdef __WINDOWS__
Text.FindAndReplace(_T("\r\n"), _T("\n"), 0, ZenLib::Ztring_Recursive); //MediaInfoLib handle differences between platforms, but cout too!
#endif //__WINDOWS__
std::cout<<Text.To_Local().c_str()<<std::endl;
}

I think To_Local() will convert the Unicode string to a single-byte encoding using the user's active Codepage, which means all chars not in that Codepage will simply show up as "?" chars :scared:

The good news is that this is easy to fix by using the UTF-8 multi-byte encoding instead:

std::cout<<Text.To_UTF8().c_str()<<std::endl;

I think others may face the same problem. So what do you think about committing the above change or at least add a CLI switch for UTF-8 output?

:thanks:

gergev
20th November 2010, 01:30
Originally Posted by Lawk
by default, "Enable context menu" is not ticked, but it's still in the context menu. Ticking and unticking makes no difference. Whats up with that?

Do you use an official version (from mediainfo.sourceforge.net)? Which version? Which OS?
I tested it again, and if the box is unchecked, there is nothing in the explorer.

I have the same problem. I'm using Windows 7 home premium 64-bit. I downloaded the K-Lite codec pac 6.3.0 full, because I got no sound using gom player for video and saw a thread to d/l the pac.

Problem solved, but it added 'features' I did not want. This K-lite pac included Mediainfo 0.7.34.

During installation I was careful to opt-out of any shell integration additions if they were given, but they were installed anyway. I prefer a short list when I right click a file because 99% of the time have no need to use the many apps listed. I certainly don't need Media Info when right clicking on a txt file.

I was able to ferret out the shell installed for MPH Media Player and delete the keys with a search, but for "Media Info" there is no registry key, and for "MediaInfo" I couldn't find a reference to shell integration.

So I get the same issue as op, - ticking and unticking makes no difference.

Navigating to K-lite > Tools > MediaInfo.exe "the program can't start because mediainfo.dll is missing from your computer"

I went to sourgeforge and downloaded 0.7.36 and installed the 64-bit. Checking and unchecking explorer extension in preferences of the application also doesn't get rid of it.

I wanted to post this last week but the forum makes you wait FIVE DAYS to post anything after joining!

clsid
20th November 2010, 02:24
Look here:
HKCR\*\shell\MediaInfo

Zenitram
23rd November 2010, 02:35
I'm currently re-writing LameXP from the scratch, based on the Qt Framwork.

I do same :)

I think To_Local() will convert the Unicode string to a single-byte encoding using the user's active Codepage, which means all chars not in that Codepage will simply show up as "?" chars :scared:

To_Local() should convert to UTF-8 if locale settings were correctly set...

The good news is that this is easy to fix by using the UTF-8 multi-byte encoding instead

Hum... Seems it does not work.
Tested with Example.ogg (in the SVN in MediaInfo/Release):

Reference:
ARABIC : ئابةتثجحخدذرزسشصضطظعغـف
HEBREW : אבגדהוזחטיךכלםמןנסעףפץצְֱ
COMBINERS : ˆˇˉ˘˙˚˛˜̣̀́̃̉
CYRILLIC : ЁЂЃЄЅІЇЈЉЊЋЌЎЏ
ENGLISH : abcdefghaijklmnopqrstuvwxyz
FRENCH : aàäâåáãæÅÆ cçÇ eéèëê uùüû
GREEK : αβγδεζηθικλμνξοπρςστυφχψω
LATIN : ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņ

Current version:
ARABIC : ???????????????????????
HEBREW : ?????????????????????????
COMBINERS : ^?¯??°?~`´~??
CYRILLIC : ??????????????
ENGLISH : abcdefghaijklmnopqrstuvwxyz
FRENCH : aàäâåáãæÅÆ cçÇ eéèëê uùüû
GREEK : aß?de??????µ???p??st?f???
LATIN : AaAaAaCcCcCcCcDdÐdEeEeEeEeEeGgGgGgGgHhHhIiIiI
iIiIi??JjKk?LlLlLl??LlNnNn

With UTF-8 forced:
ARABIC : ئابةتثجØ*خدذرزسشصضطظعغÙ?Ù
?
HEBREW : ×?×'×'×"×"××-×-×~×T×s×>×o×?×z×Y×*סעףפץצ
Ö°Ö±
COMBINERS : Ë+Ë+Ë%Ë~ËTËsË>ËoÌ?Ì?̃Ì%Ì£
CYRILLIC : Ð?Ð'ЃÐ"Ð.Ð+Ð+Ð^Ð%ÐSÐ<ÐOÐZÐ?
ENGLISH : abcdefghaijklmnopqrstuvwxyz
FRENCH : aÃ*äâåáãæÃ.Ã+ cçÃ+ eéèëê uùüû
GREEK : αβγδεζηθικλμνξοÏ?Ï?Ï'σÏ"Ï.Ï+Ï
+Ï^Ï%
LATIN : Ä?Ä?Ä'ăÄ"Ä.Ä+Ä+Ä^Ä%ÄSÄ<ÄOÄ?ÄZÄ?Ä?Ä'Ä'Ä"Ä"ÄÄ-
Ä-Ä~ÄTÄsÄ>ÄoÄ?ÄzÄYÄ*ġĢģĤĥĦħĨĩĪīĬÄ*ĮįİıIJijĴĵĶķĸĹĺĻļĽľ
Ä¿Å?Å?Å'ŃÅ"Å.Å+


Forcing to UTF-8 is worse. Tested on Windows 7 French.
But maybe the Qt wrapper you use accept UTF-8 as input, so this is OK (for example, if I redirect the output to a file, this is UTF-8). But Command line does not accept UTF8... So I can not put your code "as is", I will try to see if I can add an option for UTF-8 output.

Zenitram
23rd November 2010, 02:38
I downloaded the K-Lite codec pac 6.3.0 full, because I got no sound using gom player for video and saw a thread to d/l the pac.

Problem solved, but it added 'features' I did not want. This K-lite pac included Mediainfo 0.7.34.

Acutally, it does *not* include official MediaInfo.
It include somebody else "MediaInfo Lite". This is not a product from me.

Due to lot of complains about MediaInfo in K-Lite pack + Official MediaInfo install, I remove the contect menu from K-Lite during installation of MediaInfo since version 0.7.36.

LoRd_MuldeR
23rd November 2010, 20:34
I do same :)

Huh?

To_Local() should convert to UTF-8 if locale settings were correctly set...

I don't think so.

Inside ZenLib the To_Local() function calls WideCharToMultiByte() with "CP_ACP" selected, which "...instructs the API to use the currently set default Windows ANSI codepage".

Also the MSDN doc of WideCharToMultiByte() clearly states: "The new character string is not necessarily from a multibyte character set."

And indeed, if that target Codepage doesn't support the Unicode character contained in the original wchar_t (UTF-16) string, it is simply replaced by a "?" char :rolleyes:

For example on a German system the default Codepage is "Windows-1252 (Western European)", which doesn't support any Russian or Arabic or Chinese or Japanese characters.

Since the default Codepage can differ from system to system (depending on what the user has configured), it's extremely unreliable to use this method...

Hum... Seems it does not work.
Tested with Example.ogg (in the SVN in MediaInfo/Release):

Forcing to UTF-8 is worse. Tested on Windows 7 French.
But maybe the Qt wrapper you use accept UTF-8 as input, so this is OK (for example, if I redirect the output to a file, this is UTF-8). But Command line does not accept UTF8... So I can not put your code "as is", I will try to see if I can add an option for UTF-8 output.

IMO, forcing UTF-8 is safe. That's because UTF-8, in contrast to all those region specific Codepages, is a form of real multi-byte (http://en.wikipedia.org/wiki/UTF-8#Description) encoding.

Thus UTF-8 is able to preserve the complete Unicode space. So when converting from wchar_t (UTF-16) to UTF-8, absoloutely no information get's lost.

Of course the result only looks correctly, if the application, who receives the UTF8-encoded data, is treating the character stream as UTF-8.

The Windows console, by default, does not do this! You have to enforce it by calling "chcp 65001". This can also be done with SetConsoleOutputCP(CP_UTF8).

If a custom application is reading the 'stdout' from MediaInfo, then it's of course up to the programmer to handle the character stream properly!

But with UTF-8 encoded data the program at least has a chance to handle the input correctly ;)

A stream that was converted to the "local" CP already might contain unrecoverable "?" chars, so there is no way for the programmer to retain the original string.

Here is a good article on the topic that I found quite helpful:
http://www.codeproject.com/KB/cpp/unicode_console_output.aspx

(Strange enough, using wprintf() with a wchar_t* does not work, as it converts to the local Codepage again and thus will fail on characters that aren't support by the user's default Codepage. The normal printf() works, but only by converting the wchar_t* to an UTF8-encoded char* first and only when setting the Console's CP to UTF-8 and only when a suitable Console Font, such as "Lucidia Console" is selected)

LoRd_MuldeR
23rd November 2010, 23:12
Okay, after some more testing, it seems even printf() sometimes screws up the UTF-8 string :rolleyes:

So I think it's more safe to use a "raw" WriteFile(), which also avoids your FindAndReplace(). There is a special WriteConsole() function, but it fails on File redirection.

Thus after all I would suggest this code:
inline void STRINGOUT(ZenLib::Ztring Text)
{
#ifdef __WINDOWS__
DWORD CharsWritten;
std::string Buffer = Text.To_UTF8();
SetConsoleOutputCP(CP_UTF8);
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), Buffer.c_str(), Buffer.length(), &CharsWritten, NULL);
#else
std::cout<<Text.To_Local().c_str()<<std::endl;
#endif //__WINDOWS__
}


Seems to work fine for me. For both, Console output and File redirection :)

http://img72.imageshack.us/img72/4527/clipboard26.th.png (http://img72.imageshack.us/img72/4527/clipboard26.png)

(Just make sure you use the "Lucidia Console" font. The "Raster Fonts" Font doesn't work with Unicode! Some Asian chars don't even show up with "Lucida Console" though)

Zenitram
24th November 2010, 00:33
Huh?

I am revamping my GUI with Qt too.

Inside ZenLib the To_Local() function calls WideCharToMultiByte() with "CP_ACP" selected, which "...instructs the API to use the currently set default Windows ANSI codepage".

I was doing what seems the best for the output.


Since the default Codepage can differ from system to system (depending on what the user has configured), it's extremely unreliable to use this method...

this was the most reliable method I had to display non-US characters (I am French, I have theses codepage issues too ;-) )


IMO, forcing UTF-8 is safe. That's because UTF-8, in contrast to all those region specific Codepages, is a form of real multi-byte encoding.

I agree... Only if I can display data on the command line! I actually output UtF-8 on Linux and Mac, the problem was only Windows...
And the proposed solutions were not good.


Okay, after some more testing, it seems even printf() sometimes screws up the UTF-8 string :rolleyes:

I tested some solutions, and I was having the same conclusion :).

So I think it's more safe to use a "raw" WriteFile(), which also avoids your FindAndReplace(). There also is WriteConsole(), but it fails on File redirection.

Thus after all I would suggest this code:
(...)
Seems to work fine for me. For both, Console output and File redirection :)

I confirm, works well, except if the default font is set, but this is the output with the less errors (if I copy/paste the CLI output, I have all characters!).

So I use thie method.

LoRd_MuldeR
24th November 2010, 00:42
I am revamping my GUI with Qt too.

I see.

I confirm, works well, except if the default font is set, but this is the output with the less errors (if I copy/paste the CLI output, I have all characters!).

I think with the default "Raster Fonts" Font you will never be able to get better Unicode output, because that font simply doesn't contain a representation for most characters.

And, most important, with the proposed method we can have "proper" Unicode-safe redirection of MediaInfo's output to a file or to another application, regardless of how it shows up in the console.

So I use thie method.

:thanks:

ckmox
30th November 2010, 04:43
MediaInfo 0.7.37

some media media files doesnt show the "Writing library" and "Encoding settings" this is confirmed happening on h264 videos in mkv container i dont know about others
but this said h264 videos in mkv container has x264 settings shown when using a hex editor

anyone can confirm this behavior too?

Kurtnoise
30th November 2010, 13:33
does it work with previous builds ?

In sourceforge website, you can find different packages.

ckmox
1st December 2010, 12:22
@Kurtnoise

Version 0.7.36 is working fine so i guess ill stick to this old version until the newer version fix this issue

thanks

Zenitram
1st December 2010, 12:59
some media media files doesnt show the "Writing library" and "Encoding settings" this is confirmed happening on h264 videos in mkv container i dont know about others
but this said h264 videos in mkv container has x264 settings shown when using a hex editor

anyone can confirm this behavior too?

I can confirm with sample from other another guy, this is not for all MKV, weird, but with my development tree this is OK, so I do not not investigate more on this 0.7.37 bug.
Please test http://sourceforge.net/projects/mediainfo/files/development_snapshots/0.7.37%2B/MediaInfo_GUI_20101201_Windows_i386_WithoutInstaller.7z/download

Not related, in this version I added implicit SBR and PS detection (for having HE-AACv1 and v2 detection in all cases, even if the header has not the explicit SBR and/or PS info, and without empirical tests, I parse the raw stream now in order to find the SBR and PS data, so no more false-positive complains!), AAC bistream decoding is difficult and I hope not to have implemented it, if anybody is curious, could he test with his files and let me know if it is as expected?

ckmox
2nd December 2010, 01:54
I can confirm with sample from other another guy, this is not for all MKV, weird, but with my development tree this is OK, so I do not not investigate more on this 0.7.37 bug.
Please test http://sourceforge.net/projects/mediainfo/files/development_snapshots/0.7.37%2B/MediaInfo_GUI_20101201_Windows_i386_WithoutInstaller.7z/download


ye its random mkv not all mkv but with this testing version its working fine now, nice work :thanks:

ipanema
11th December 2010, 16:59
I'd like to write some code which checks for AAC audio in an MP4 file. I'm trying to figure out where the variable/fixed rate flag and the average bitrate and maximum bit rate of the AAC stream is stored in the MP4 file. Mediainfo seems to find this info and displays it like this for example:

Bit rate mode : Variable
Bit rate : 128 Kbps
Maximum bit rate : 192 Kbps

There is a decoder-specific info section of the MP4 file which is 2 bytes in length and gives some basic info about the AAC stream as described here

http://wiki.multimedia.cx/index.php?title=Understanding_AAC#Packaging.2FEncapsulation_And_Setup_Data

but there is nothing about average or max bitrate, or fixed/variable flag.

How does Mediainfolib extract this info?

I've had a look at the mediainfo source but it's clear that it is going to take some time to understand it. If the info is easily located or calculated, can anyone give any pointers?

Zenitram
11th December 2010, 17:17
I'd like to write some code which checks for AAC audio in an MP4 file.

Why not using MediaInfo library? ;-)


There is a decoder-specific info section of the MP4 file which is 2 bytes in length and gives some basic info about the AAC stream as described here

http://wiki.multimedia.cx/index.php?title=Understanding_AAC#Packaging.2FEncapsulation_And_Setup_Data

but there is nothing about average or max bitrate, or fixed/variable flag.


There is nothing in the raw AAC stream about bitrate. Don't hope.
(this is the reason AAC bitrate is not everywhere)


How does Mediainfolib extract this info?

In MP4, from moov_trak_mdia_minf_stbl_stsz atom (the "sample size" atom).
This does not depend of the raw stream format, but of the container. MP4 header has the size of each sample.

I've had a look at the mediainfo source but it's clear that it is going to take some time to understand it. If the info is easily located or calculated, can anyone give any pointers?

Good luck!

SeeMoreDigital
11th December 2010, 18:57
There is nothing in the raw AAC stream about bitrate. Don't hope.
(this is the reason AAC bitrate is not everywhere)

It may be possible to determine the "approximate" bit-rate by using the files duration and total size... I think this is how Quicktime7 player does it :eek:

http://img149.imageshack.us/img149/1195/snap1sh.png

b66pak
11th December 2010, 19:47
I think this is how Quicktime7 player does it

QT is reading the entire file first!...use a big aac file to see this! (1-2hour)...
_

SeeMoreDigital
11th December 2010, 20:14
QT is reading the entire file first!...use a big aac file to see this! (1-2hour)...That seems logical :mad:

ipanema
12th December 2010, 14:18
Thanks for the suggestions. The average should be calculable without reading the whole file - I think you can total some values in the MP4 file header and divide by duration.

Had a quick look in the moov_trak_mdia_minf_stbl_stsz atom (sample size) but didn't notice any significant differences between files that MediaInfo said were Fixed and Variable bit rates. So far at least.

Zenitram
12th December 2010, 17:46
Thanks for the suggestions. The average should be calculable without reading the whole file - I think you can total some values in the MP4 file header and divide by duration.

This is the case for MP4.
But SeeMoreDigital is speaking about raw AAC files, without MP4 header (= this is an ADIF or ADTS container, without index like in MP4), and in this case, it is not possible to know the duration whithout parsing the whole file. It is planned to add an option for full parsing, but not a priority currently.

Had a quick look in the moov_trak_mdia_minf_stbl_stsz atom (sample size) but didn't notice any significant differences between files that MediaInfo said were Fixed and Variable bit rates. So far at least.

In theory:

CBR:
Sample Size = the size per sample
Number of entries = 0

VBR:
Sample Size = 0
Number of entries = the count of sample
followed by the sizes (4 bytes)

Actually, AAC is always "VBR", this is not exactly the same count of bytes per sample, but MediaInfo considers stream as CBR is if this is +/-1% in the case of MP4 files.

LoRd_MuldeR
12th December 2010, 17:57
Actually, AAC is always "VBR", this is not exactly the same count of bytes per sample, but MediaInfo considers stream as CBR is if this is +/-1% in the case of MP4 files.

As far as I understood from the specs (don't have them at hand right now), AAC has a "bit reservoir" similar to MP3. But in contrast to MP3, where you have fixed frames sizes and the bit reservoir is actually written into the "unused" space of other frames, in AAC the "reservoir" simply allows you to make the frames a bit bigger (or smaller) than the nominal bitrate would allow and still call that beast a "CBR" stream.

Zenitram
12th December 2010, 18:00
(...) to make the frames a bit bigger (or smaller) than the nominal bitrate would allow and still call that beast a "CBR" stream.

So I am not too much wrong with my hack :).
But the decision of "+/-1%" is 100% subjective, because I never found an "official" value about the maximal difference between frames. Let me know if someone thinks he has a better threshold value!

LoRd_MuldeR
12th December 2010, 19:40
So I am not too much wrong with my hack :).
But the decision of "+/-1%" is 100% subjective, because I never found an "official" value about the maximal difference between frames. Let me know if someone thinks he has a better threshold value!

I think one would have to parse the entire stream and update the "reservoir" value after each frame, depending on the size of each individual frame.
Only if the reservoir size is never violated (i.e. never becomes negative) you can still call this a permissible "CBR" stream...

reservoir_next = min[reservoir_prev + (nominal_frame_size - actual_frame_size), max_reservoir_size]

ipanema
13th December 2010, 19:01
In theory:

CBR:
Sample Size = the size per sample
Number of entries = 0

VBR:
Sample Size = 0
Number of entries = the count of sample
followed by the sizes (4 bytes)

That's what I was expecting. But the only file I have which MediaInfo says has Constant bitrate for AAC has

Sample Size = 0
Number of entries = 2171

and a quick look through the first hundered of the Sample Size Table has values between 320 and 410 which has a variation a lot bigger than 1%.

For this file MediaInfo says:

Bit rate mode : Constant
Bit rate : 128 Kbps

For files which are variable bitrate, as regards the "Max bitrate" figure, could I simply take the average of all the entries in the Sample Size Table, and the maximum value of all the entries and arrive at a max bitrate figure by:

max bitrate = max value * average bitrate / average of values

where "average bitrate" was calculated as described earlier (total bytes in stream / duration).

Zenitram
13th December 2010, 19:18
and a quick look through the first hundered of the Sample Size Table has values between 320 and 410 which has a variation a lot bigger than 1%.

Can I have the file so I look about the reason this is indicated as CBR?

For files which are variable bitrate, as regards the "Max bitrate" figure, could I simply take the average of all the entries in the Sample Size Table, and the maximum value of all the entries and arrive at a max bitrate figure by:

max bitrate = max value * average bitrate / average of values

where "average bitrate" was calculated as described earlier (total bytes in stream / duration).

each sample has a duration (moov_trak_mdia_minf_stbl_stts, "Time to Sample"), so you need calculate max bitrate with both atoms.

ipanema
13th December 2010, 19:48
Can I have the file so I look about the reason this is indicated as CBR?

It can be downloaded here:

http://rapidshare.com/#!download|294tl|193391115|Canon_SX1_IS_Video_Test_640x480.mp4|13291

each sample has a duration (moov_trak_mdia_minf_stbl_stts, "Time to Sample"), so you need calculate max bitrate with both atoms

This particular file has only 1 entry in the time-to-sample table, so I guess this sample duration applies to all of the entries in the sample size table. I assume that either the time-to-sample table must have the same number of entries as the sample size table or just 1 entry.

b66pak
13th December 2010, 20:00
bug (?) report mediainfo 0.7.38.beta:

Audio
ID : 1
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Mode : Joint stereo
Codec ID : 55
Codec ID/Hint : MP3
Duration : 42mn 59s
Bit rate mode : Variable
Bit rate : 128 Kbps
Minimum bit rate : 32.0 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Video delay : 720ms it should be Audio delay
Stream size : 39.3 MiB (11%)
Alignment : Split accross interleaves
Interleave, duration : 24 ms (0.58 video frame)
Interleave, preload duration : 1515 ms
Writing library : LAME3.98
Encoding settings : -m j -V 4 -q 0 -lowpass 17.5 --vbr-new -b 32
_

Kurtnoise
13th December 2010, 20:08
does it an audio stream only ?

b66pak
13th December 2010, 20:54
sorry...full output:
General
Complete name : tvshow.avi
Format : AVI
Format/Info : Audio Video Interleave
File size : 352 MiB
Duration : 42mn 59s
Overall bit rate : 1 146 Kbps
Writing application : VirtualDubMod 1.5.10.2 (build 2540/release)
Writing library : VirtualDubMod build 2540/release

Video
ID : 0
Format : MPEG-4 Visual
Format profile : Advanced Simple@L5
Format settings, BVOP : Yes
Format settings, QPel : No
Format settings, GMC : No warppoints
Format settings, Matrix : Default (H.263)
Muxing mode : Packed bitstream
Codec ID : XVID
Codec ID/Hint : XviD
Duration : 42mn 59s
Bit rate : 1 006 Kbps
Width : 624 pixels
Height : 352 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.191
Stream size : 309 MiB (88%)
Writing library : XviD 1.2.0SMP (UTC 2006-01-08)

Audio
ID : 1
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Mode : Joint stereo
Codec ID : 55
Codec ID/Hint : MP3
Duration : 42mn 59s
Bit rate mode : Variable
Bit rate : 128 Kbps
Minimum bit rate : 32.0 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Video delay : 720ms
Stream size : 39.3 MiB (11%)
Alignment : Split accross interleaves
Interleave, duration : 24 ms (0.58 video frame)
Interleave, preload duration : 1515 ms
Writing library : LAME3.98
Encoding settings : -m j -V 4 -q 0 -lowpass 17.5 --vbr-new -b 32
_

Zenitram
13th December 2010, 21:34
Video delay : 720ms it should be Audio delay

In the audio part, this means it is the delay between the considered stream and the video stream.
Isn't it enough meaningful?

this is definitely not an "audio delay", because this is compared to the video stream, maybe a better English proposal?

Zenitram
13th December 2010, 22:50
It can be downloaded here:

This file has a DecoderConfigDescrTag:
00CA6672 DecoderConfigDescrTag (15 bytes)
00CA6672 Header (2 bytes)
00CA6672 type: 4 (0x04)
00CA6673 size: 17 (0x11)
00CA6674 objectTypeIndication: 64 (0x40) - Audio ISO/IEC 14496-3 (AAC)
00CA6675 streamType: 5 (0x05) - AudioStream
00CA6675 upStream: No
00CA6675 reserved: Yes
00CA6676 bufferSizeDB: 1536 (0x000600)
00CA6679 maxBitrate: 128000 (0x0001F400)
00CA667D avgBitrate: 128000 (0x0001F400)

So I use theses values (maxBitrate and avgBitrate), they are same so this is considered as CBR.
Actually, I should maybe change my +/-1% to +/-5% maybe...


This particular file has only 1 entry in the time-to-sample table, so I guess this sample duration applies to all of the entries in the sample size table. I assume that either the time-to-sample table must have the same number of entries as the sample size table or just 1 entry.

In your case, all AAC frames are 1024 sample long (1024/44100 timescale = ~23.22ms), but this is not always the case (AAC frames can be 120/128/960/1024 sample long), so if you look for a maximal bitrate, you must handle the case of different AAC frame duration.

b66pak
13th December 2010, 23:30
In the audio part, this means it is the delay between the considered stream and the video stream.
Isn't it enough meaningful?

this is definitely not an "audio delay", because this is compared to the video stream, maybe a better English proposal?

is confusing...may be a simple "delay"?
_

ipanema
14th December 2010, 12:20
If the delay is ALWAYS relative to the video stream, then I would agree that just "delay" is less confusing (with a note in the documentation to say that delays are relative to the video stream).

Alternatively something like "Delay relative to video", but that might be a bit to long.

b66pak
14th December 2010, 20:37
@Zenitram you may want to consider audio only mkv (mka) with audio delay (with single or multiple tracks)...

eac3to log:
MKA, 2 audio tracks, 0:43:48
1: MP3, 2.0 channels, 32kbps, 48kHz, 24ms
2: AC3, 5.1 channels, 640kbps, 48kHz

mediainfo log:
Audio #1
ID : 1
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Mode : Joint stereo
Mode extension : MS Stereo
Muxing mode : Header stripping
Codec ID : A_MPEG/L3
Codec ID/Hint : MP3
Duration : 43mn 48s
Bit rate mode : Variable
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy

Audio #2
ID : 2
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Muxing mode : Header stripping
Codec ID : A_AC3
Duration : 43mn 48s
Bit rate mode : Constant
Bit rate : 640 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 201 MiB
_

Zenitram
15th December 2010, 22:56
Alternatively something like "Delay relative to video", but that might be a bit to long.

I test and see with this field name

Zenitram
15th December 2010, 22:57
@Zenitram you may want to consider audio only mkv (mka) with audio delay (with single or multiple tracks)...

Absolute "Delay" is hidden by default, only the delay relative to video is displayed.
but it should be available in "advanced mode" (check this item in "Debug" menu) in "Delay" field.

Mtz
17th December 2010, 13:53
Hi, Zenitram!
No info about AAC bitrate in this file (http://www.mediafire.com/?99h7hrhtqd6ok0v).

enjoy,
Mtz