Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 5th August 2013, 23:39   #21  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,042
Yes, you only get error when you try to play in VD. VDMod just outputs silence, no error.

VLC plays Ok, as does SMPlayer, UMPLayer, KMPlayer, Pot Player Media Player Classic HC, WMP v9.0, MS WMP v6.4(xp old version player).
Only failing player found was GOM.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 6th August 2013, 02:54   #22  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
It seems Fcchandler's AAC ACM codec does some validation on the stream format structure contents.

On your included sample wfex->cbSize is 0, Fcchandler is expecting a minimum of 2 bytes of codec specific data, apparently that being the two-byte AAC AudioSpecificConfig. But I cannot see that he accesses that information anywhere so it might be possible to hack the code to just ignore it.

I hex edited your sample wfex->cbSize from 0 to 2 and now VDub accepts your sample with a header needs repair warning.

When played it appears mostly silent with some shuffling noise in the background, is this correct.

Do you have another sample with some distinctive sound, i.e. count 1 2 3 to check.

Code:
static bool IsValidAAC(const WAVEFORMATEX *wfex, const MyData *md)
{
	// Does "wfex" describe an AAC format we can decode?

	if (wfex != NULL)
	{
		int i;

		if (wfex->wFormatTag != WAVE_FORMAT_RAW_AAC1)
		{
			if (!(md->dwFlags & AACACM_706D)) goto Abort;
			if (wfex->wFormatTag != WAVE_FORMAT_FAAC51) goto Abort;
		}

		for (i = 0; i < AACACM_NCHANS; ++i)
		{
			if (wfex->nChannels == chan_map[i]) break;
		}
		if (i == AACACM_NCHANS) goto Abort;

		for (i = 0; i < AACACM_NFREQS; ++i)
		{
			if (wfex->nSamplesPerSec == freq_map[i]) break;
		}
		if (i == AACACM_NFREQS) goto Abort;

		if (wfex->nAvgBytesPerSec == 0) goto Abort;
		if (wfex->nBlockAlign == 0) goto Abort;
		if (wfex->cbSize < 2) goto Abort;
		
		return true;
	}
Abort:
	return false;
}
Code:
static inline unsigned short make_aac_config(DWORD srate, WORD chans)
{
	// Create two-byte AAC AudioSpecificConfig

	unsigned short asc = 0;

	// AudioSpecificConfig, 2 bytes

	//   LSB      MSB
	// xxxxx... ........  object type (00010 = AAC LC)
	// .....xxx x.......  sampling frequency index (0 to 11)
	// ........ .xxxx...  channels configuration (1 to 7)
	// ........ .....x..  frame length flag (0 = 1024, 1 = 960)
	// ........ ......x.  depends on core coder (0)
	// ........ .......x  extensions flag (0)
		
	//   LSB      MSB
	// .....000 0....... = 96000
	// .....000 1....... = 88200
	// .....001 0....... = 64000
	// .....001 1....... = 48000
	// .....010 0....... = 44100
	// .....010 1....... = 32000
	// .....011 0....... = 24000
	// .....011 1....... = 22050
	// .....100 0....... = 16000
	// .....100 1....... = 12000
	// .....101 0....... = 11025
	// .....101 1....... =  8000

	switch (srate) {
	case 96000: break;
	case 88200: asc |= 0x8000; break;
	case 64000: asc |= 0x0001; break;
	case 48000: asc |= 0x8001; break;
	case 44100: asc |= 0x0002; break;
	case 32000: asc |= 0x8002; break;
	case 24000: asc |= 0x0003; break;
	case 22050: asc |= 0x8003; break;
	case 16000: asc |= 0x0004; break;
	case 12000: asc |= 0x8004; break;
	case 11025: asc |= 0x0005; break;
	case  8000: asc |= 0x8005; break;
	default:
		return 0;
	}

	//   LSB      MSB
	// ........ .0001... = 1 channel
	// ........ .0010... = 2 channels
	// ........ .0011... = 3 channels
	// ........ .0100... = 4 channels
	// ........ .0101... = 5 channels
	// ........ .0110... = 6 channels
	// ........ .0111... = 8 channels

	switch (chans) {
	case 1: asc |= 0x0800; break;
	case 2: asc |= 0x1000; break;
	case 3: asc |= 0x1800; break;
	case 4: asc |= 0x2000; break;
	case 5: asc |= 0x2800; break;
	case 6: asc |= 0x3000; break;
	case 8: asc |= 0x3800; break;
	default:
		return 0;
	}

	return (asc | 0x0010);
}
IanB is offline   Reply With Quote
Old 6th August 2013, 10:27   #23  |  Link
belonesox
Registered User
 
Join Date: May 2010
Location: Moscow, Russia
Posts: 47
Quote:
Originally Posted by IanB View Post
Do you have another sample with some distinctive sound, i.e. count 1 2 3 to check.
This file generated by ffmpeg with "-acodec libvo_aacenc"
There another sample with some distinctive sound.
belonesox is offline   Reply With Quote
Old 6th August 2013, 17:31   #24  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,042
Thread link and problem reported to GOM Labs.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 6th August 2013, 19:42   #25  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,370
Quote:
On your included sample wfex->cbSize is 0, Fcchandler is expecting a minimum of 2 bytes of codec specific data, apparently that being the two-byte AAC AudioSpecificConfig. But I cannot see that he accesses that information anywhere so it might be possible to hack the code to just ignore it.
Is AudioSpecificConfig mandatory (and the sample not spec compliant)?

Another sample: http://www.wilbertdijkhof.com/avi-aac.zip (contains AAC LC 48 khz 5.1 channels). bytes of AudioSpecificConfig = 11B0. Yes, i think the channels are wrongly coded, but it opens and plays fine (Virtualdub and AviSynth).

Btw, AudioSpecificConfig is larger than 2 bytes in case of HE-AAC with explicit signaling of SBR/PS: http://msdn.microsoft.com/en-us/library/windows/desktop/dd742784%28v=vs.85%29.aspx
Wilbert is offline   Reply With Quote
Old 6th August 2013, 22:51   #26  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Hacking the wfex->cbSize works on the new sample, I hear a guy speaking in Russian.

I will have a proper look at the AAC ACM source code over the weekend see what the downside of removing the wfex->cbSize<2 check is.

You should probably also raise a bug report with the ffmpeg crew about the lack of AudioSpecificConfig data in the avi header.


Also when putting files on dropbox, etc, for explicit download by others, rename them to have a .BIN file extension or wrap them in an archive format like .zip, .7z, .rar, etc. It will stop the smart arse dropbox site from wanting to play the files at you instead of offering a simple download.
IanB is offline   Reply With Quote
Old 6th August 2013, 23:18   #27  |  Link
creaothceann
Registered User
 
Join Date: Jul 2010
Location: Germany
Posts: 357
Or just use mega.
creaothceann is offline   Reply With Quote
Old 19th August 2013, 17:52   #28  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,370
Quote:
You should probably also raise a bug report with the ffmpeg crew about the lack of AudioSpecificConfig data in the avi header.
Done: https://trac.ffmpeg.org/ticket/2883

@belonesox, you can also use AVIMux for muxing your avi and aac streams (it doesn't seem to write the bit depth though). It doesn't have this problem.

Last edited by Wilbert; 19th August 2013 at 17:56.
Wilbert is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 18:18.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.