Printable Version of Topic
Click here to view this topic in its original format
Unofficial VirtualDub Support Forums > VirtualDub Filters and Filter Development > Ac3 Input Plugin: Invalid Ac-3 Stream


Posted by: ale5000 Dec 18 2011, 03:16 AM
Sample file (AC3.ac3 - 1.04 MB): http://www.multiupload.com/WRDWSLWNWU

It say: Invalid AC-3 stream.

FIXED (AC-3 ACM Codec 2.0 and AC-3 input plugin 1.8)

Posted by: fccHandler Dec 18 2011, 04:49 AM
This has a 'bsid' field with a value of 9, which is invalid according to my copy of the Dolby Digital spec. When I play it in MPlayer, it reports a sample rate of 22050 Hz which is also invalid.

I suspect it is using some extended form of Dolby Digital, but without specs I can't support it at this time. I will see what I can find out about it online.

Posted by: ale5000 Dec 18 2011, 12:40 PM
Maybe this can help: https://vob2mkv.svn.codeplex.com/svn/tags/release-1.0.4.2/mkvmux/mkvstreamaudioac3.cpp

QUOTE
BSID <= 8 !! The private data is void ??? Corresponding ACM wFormatTag : 0x2000 ; channel number have to be read from the corresponding audio element

AC3/BSID9 and AC3/BSID10 (DolbyNet) :
The ac3 frame header has, similar to the mpeg-audio header a version field. Normal ac3 is defiened as bitstream id 8 (5 Bits, numbers are 0-15). Everything below 8 is still compatible with all decoders that handle 8 correctly. Everything higher are additions that break decoder compatibility.
For the samplerates 24kHz (00); 22,05kHz (01) and 16kHz (10) the BSID is 9
For the samplerates 12kHz (00); 11,025kHz (01) and 8kHz (10) the BSID is 10

Posted by: fccHandler Dec 22 2011, 03:48 AM
I've uploaded new builds of both the AC-3 file input plugin and the AC3ACM Codec with support for the low sampling rate extensions (bsid=9 and bsid=10):

http://fcchandler.home.comcast.net/Plugins/AC3
http://fcchandler.home.comcast.net/AC3ACM

AC3ACM will decode low sampling rates, but it will not let you encode them for several reasons:

The ac3enc source by Fabrice Bellard does not support them, and I don't feel confident enough to try and fix it.

I did not find any official specs which describe these extensions, so I don't know how much support they have in the real world. (Especially hardware devices.)

If I were to expose these, the number of encoding formats shown in VirtualDub's Compression dialog would triple. With "Show all formats" chosen it would grow from the already ridiculous 342 to over a thousand!

Posted by: ale5000 Dec 22 2011, 03:12 PM
In the AC-3 ACM codec the AC3ACM.inf of 32 and 64-bit codec have the same name, I haven't tried but probably this will break the uninstall because one file will overwrite the other (the inf folder is only one).

FIXED (AC-3 ACM Codec 2.1)


Also in the AC-3 input plugin => AudioSourceAC3.cpp line 120:
CODE
  // Calculate sample rate in nanoseconds
  srcInfo.mSampleRate.mNumerator   = 1000000000;
  srcInfo.mSampleRate.mDenominator = (uint32)
   ((mDuration * 1000000000) / mLength + 0.5);

  srcInfo.mSampleRate.mNumerator   = mRawFormat.nSamplesPerSec;
  srcInfo.mSampleRate.mDenominator = 1536;

Does it make sense to set mNumerator and mDenominator two times consecutively?

FIXED (AC-3 input plugin 1.9)

Posted by: fccHandler Dec 22 2011, 05:18 PM
QUOTE (ale5000 @ Dec 22 2011, 11:12 AM)
In the AC-3 ACM codec the AC3ACM.inf of 32 and 64-bit codec have the same name, I haven't tried but probably this will break the uninstall because one file will overwrite the other (the inf folder is only one).

Good point, I had not thought of that. I don't have a 64-bit system at home to check, but if all .inf are saved in the same folder then it does make sense to give them different names.

QUOTE (ale5000 @ Dec 22 2011, 11:12 AM)
Does it make sense to set mNumerator and mDenominator two times consecutively?

Nope. The second one was meant to be a quick test, and being lazy I just left the old code there in case I changed my mind. The test worked well so I kept it, but I forgot to go back and clean up the function.

Posted by: fccHandler Dec 23 2011, 04:14 AM
AC3ACM v2.1 is up. I changed the name of the .inf for the 64-bit version, and added very experimental support for tag WAVE_FORMAT_EXTENSIBLE. I don't expect that to break anything, but if necessary there is a configuration option to turn it off:

http://fcchandler.home.comcast.net/AC3ACM

So far I have not found any application which works with WAVE_FORMAT_EXTENSIBLE, including VirtualDub. It is possible I am doing it wrong. Hard to say at this point...

I cleaned up the source code of the AC-3 input plugin:

http://fcchandler.home.comcast.net/Plugins/AC3

Posted by: ale5000 Dec 23 2011, 08:42 PM
Sample files (AC3 WAVE_FORMAT_EXTENSIBLE tests.zip - 9.78 MB): http://www.multiupload.com/IJ5FY58NV6

GUID by ffmpeg for FAAD AAC => {0000706d-0000-0010-8000-00aa00389b71}
GUID by ffmpeg for AC-3 => {00002000-0000-0010-8000-00aa00389b71}
GUID by AC-3 ACM Codec => {e06d802c-db46-11cf-b4d1-00805f6cbbea}

Windows Media Player seems to support the decoding of the file from AC-3 ACM Codec through ffdshow-tryouts (but not the one from ffmpeg)
Other players doesn't support anything apparently.

Can you support both GUID for decoding in the ACM codec, please?

Posted by: ale5000 Dec 23 2011, 09:47 PM
Sample file (8.1 PCM.avi - 2.07 MB): http://www.multiupload.com/NZJ4X899AX

Is it possible to support downmix from 9 channels PCM?

Posted by: fccHandler Dec 24 2011, 04:13 AM
QUOTE (ale5000 @ Dec 23 2011, 04:42 PM)
GUID by ffmpeg for AC-3 => {00002000-0000-0010-8000-00aa00389b71}

That actually makes sense, since it matches the other GUIDs in ksmedia.h which appear to be derived from format tags. Good call.

QUOTE (ale5000 @ Dec 23 2011, 05:47 PM)
Is it possible to support downmix from 9 channels PCM?

I don't know, but I will look into the possibility at some point. Right now I've got my hands full with the release of the new Plugin SDK.

Powered by Invision Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)