How to convert FLAC 6.1 / 7.1 to Dolby AC3 5.1 for SPDIF output on-the-fly using ffdshow? This toke me many hours to solve.
Just browse the Output settings in ffdshow audio decoder, and there is the option to encode as AC3. I already have that working for AAC 5.1 file source. But strangely it does not work with FLAC 6.1. According to some forum posts converting from 6.1 is simply not supported by ffdshow.
From google it seems that shark007 codec has such support if set correctly, but I don’t want to try out another codec pack yet.
Then I found madFlac 1.10, which has an option of limit output to 5.1, so I thought this would work with ffdshow to output as AC3 5.1. Using a separate decoder would require changing ffdshow Codec setting for uncompressed audio to all supported, otherwise ffdshow will not process it. I tried this – it could decode FLAC 6.1 properly but it did not work with ffdshow to encode as AC3 5.1. Then I read some forum posts saying that madFlac does not really output 5.1 only, but outputs 6.1 or 7.1 with some channels emptied – perhaps I understood it wrongly, but anyway, this is a potential answer for why it didn’t work.
Finally, I think that since ffdshow has a mixer, perhaps I can use its mixer to downmix 6.1 into 5.1, then feed it into the AC3 encode function. Bingo! Setting the mixer to 3/0/2 and enabling LFE really worked – finally it outputs AC3 5.1 to SPDIF. And I disabled madFlac for now.