View Full Version : AVS (with audio) to AC3 using ffmpeg (crashes)

30th April 2009, 01:16
Hey guys,

I've got a nasty little problem with FFMPEG.

I'm using today's SVN build (tried a few from ~ 2 years ago also), and it crashes every time I try to do this:

ffmpeg.exe -i input.avs -ac 2 -ab 192000 -o output.ac3

The AVS contains 6ch, 16bit, 48KHz and a 1080p video stream (quicktime MJPG source, with 6 mono WAVs all combined in one AVS)

Now, when I use all 6 channels - no problems!

So, I'm thinking the problem is related to "-ac 2"

In other words, how the heck do I make ffmpeg do a DPLII compatible downmix of a 6ch source, assuming standard L,R,C,LFE,LS,RS channel order, and have it NOT crash??



30th April 2009, 01:20
As a side note,

Can anyone think of a clean, scriptable way to make eac3to take AVS input? I'd love to take advantage of its lovely anti-clipping features etc... Aften over ffmpeg is also a big plus.


1st May 2009, 04:11
Did you downmix to stereo in the avs script?

Also I've found some builds crash with ac3, but not others, so you may try a different ffmpeg build

1st May 2009, 20:03
I didn't - I fed it 6ch, since this is a requirement for later parts of my workflow.

This build (and the other one I have from '06-ish) both work fine when I feed them 6 channels and ask for 6, or when I feed 2 and ask for 2. It also works fine if I give it a 6ch AC3 and ask for 2ch. So it's something in the avisynth support.


1st May 2009, 21:51
I think ffmpeg don't have a downmix function for uncompressed audio.
When you use ac3 (or dts) like source, ffmpeg use the internal downmix functions of the ac3/dts decoder (like if you open in AviSynth with: NicAc3Source("surround.ac3", 2), a dpl mix is obtained).

BTW, you can make the downmix inside the avs. You can see BeHappy or MeGUI

1st May 2009, 23:21
Yes, I think that's what I'll end up doing for now.

Thanks for the advice tebasuna51.

Do you know any other apps that can take audio from avisynth and handle a downmix with a few CLI parameters?


2nd May 2009, 00:50
You can use 'pipe' commands with Sox, for instance:

wavi input.avs - | sox -t wav - -t wav - remix -m 1v0.3254,3v0.2301,5v0.2818,6v0.1627 2v0.3254,3v0.2301,5v-0.1627,6v-0.2818 | Aften -b 192 - output.ac3

This is a dpl II downmix.
For big files maybe you need the new --ignore-length parameter in the sox-14.3.0 (still rc3)