Log in

View Full Version : Avisynth / ac3 filters audio length / sample limits


Umamio
30th October 2008, 06:51
Using NicAC3, if audio samples > 2147483520 (in this case 2 channel audio at 12 hours 25 minutes 39 seconds or 1118481 frames ) the script no longer plays any audio at all.

Tested using Virtualdub, Media Player Classic, FFplay.
(Strangely, mplayer plays the audio and video)

Using AC3filter (through DirectShowSource) the same occurs, though I have not determined at which point, some time earlier.

Is this a known limitation of... something? Is it an issue of ... running out of integers? If mplayer plays back the audio then it's probably an issue with the applications. If so, apologies.

#a = NicAC3Source("D1 T80 3_2ch 384Kbps DELAY 0ms.ac3", channels=6)
#a = NicAC3Source("D1 T80 3_2ch 384Kbps DELAY 0ms.ac3", channels=2)
a = DirectShowSource("D1 T80 3_2ch 384Kbps DELAY 0ms.ac3")
v = DGdecode_MPEG2Source("D1.d2v", cpu=0, info=3).ColorMatrix(hints=true, interlaced=true)
Disc1 = AudioDub(v,a)
#a = NicAC3Source("D2 T80 3_2ch 384Kbps DELAY 0ms.ac3", channels=6)
#a = NicAC3Source("D2 T80 3_2ch 384Kbps DELAY 0ms.ac3", channels=2)
a = DirectShowSource("D2 T80 3_2ch 384Kbps DELAY 0ms.ac3")
v = DGdecode_MPEG2Source("D2.d2v", cpu=0, info=3).ColorMatrix(hints=true, interlaced=true)
Disc2 = AudioDub(v,a)
#a = NicAC3Source("D3 T80 3_2ch 384Kbps DELAY 0ms.ac3", channels=6)
#a = NicAC3Source("D3 T80 3_2ch 384Kbps DELAY 0ms.ac3", channels=2)
a = DirectShowSource("D3 T80 3_2ch 384Kbps DELAY 0ms.ac3")
v = DGdecode_MPEG2Source("D3.d2v", cpu=0, info=3).ColorMatrix(hints=true, interlaced=true)
Disc3 = AudioDub(v,a)
#a = NicAC3Source("D4 T80 3_2ch 384Kbps DELAY 0ms.ac3", channels=6)
#a = NicAC3Source("D4 T80 3_2ch 384Kbps DELAY 0ms.ac3", channels=2)
a = DirectShowSource("D4 T80 3_2ch 384Kbps DELAY 0ms.ac3")
v = DGdecode_MPEG2Source("D4.d2v", cpu=0, info=3).ColorMatrix(hints=true, interlaced=true)
Disc4 = AudioDub(v,a)

Disc1++Disc2++Disc3++Disc4
#Trim(0,1118480)

Edit: The audio still gets encoded! I guess this has nothing to do with Avisynth, still useful information for someone I suppose? This thread should probably be moved / deleted

sh0dan
30th October 2008, 11:22
Inside Avisynth all the samples are there, but it is not possible to export more samples than you mention through the VFW interface. Use SoundOut inside a script to export all sound, or BePipe or similar, that doesn't access AviSynth through VFW.

Umamio
11th November 2008, 18:17
Thanks for the information, Shodan.

Out of curiosity, do you know the reason for this VFW limitation?

tebasuna51
11th November 2008, 19:45
Out of curiosity, do you know the reason for this VFW limitation?

Inside AviSynth and NicAudio the sample_count is a int64bit value, if a old soft use a signed int32bit the max value is 2^31 = 2147483648 and can't store higer values.

Same problem with wav files, there are two fields in header to store the FileLength and DataLength with only 32 bits.
A soft than read these fields like signed int only can manage wav files <2GB, if read the fiels like unsigned integer can manage until 4GB, files >4GB always have these fiels wrong and need workarounds to be read.

When you output your script with Bepipe, a wav (uncompressed data) header must be send and now the limit is the DataLength = Sample_Count x Num_channels x BitDepth / 8 (much more restrictive, maybe the ac3Filter limit).

This >4GB wav can be encoded to aac,ac3,ogg,flac using parameters like -ignorelength, -readtoeof 1, ..., can be converted to w64 format (64 bit fields for File and Datalength)

You can use Shodan's SoundOut() or BeHappy/Bepipe to solve the problem.