Log in

View Full Version : Converting 5.1 wav to AC3


minaust
15th June 2015, 21:23
Hi folks

(I'm posting here because this is where the big-brains seem to hang out...:D)

I was recently doing an edit on a DVD, restoring the film's original ending. The 5.1 ac3 source files were brought into an avisynth script via NicAC3Source, downmixed to stereo with one of tebasuna51's downmix functions, then output to .wav with Soundout. Then I converted the .wav to .ac3 with eac3to. Piece of cake.

Then I commented out the downmix so I could also have a 5.1 .ac3. No go. I get this error:
eac3to v3.29
command line: eac3to file1.wav file1.ac3 -448
------------------------------------------------------------------------------
WAV, 5.1 channels, 2:07:20, 16 bits, 4608kbps, 48kHz
Reading WAV...
Remapping channels...
Encoding AC3 <448kbps> with libAften...
Initialization of the AC3 encoder failed. <ERROR>
Aborted at file position 262144. <ERROR>

After much fiddling around, I discovered that if I did this:
eac3to file1.wav file2.wav
file2.wav is intact and converted normally.

Here's the mediainfo dump of the offending file:
General
Complete name : File1.Wav
Format : Wave
File size : 4.10 GiB
Duration : 2h 7mn
Overall bit rate mode : Constant
Overall bit rate : 4 608 Kbps

Audio
Format : PCM
Format settings, Endianness : Little
Format settings, Sign : Signed
Codec ID : 1
Duration : 2h 7mn
Bit rate mode : Constant
Bit rate : 4 608 Kbps
Channel(s) : 6 channels
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Stream size : 4.10 GiB (100%)

Why do I need to dance the two-step?

ndjamena
16th June 2015, 01:16
Is it possible there's no Channel Layout specified and EAC3To is only applying a default in one method and not the other.

(That's the cause of most of my recent problems with MakeMKV.)

-Edit-

Or it's sending the wrong 5.1 layout to the encoder... another thing MakeMKV has been doing until recently.

minaust
16th June 2015, 02:32
Is it possible there's no Channel Layout specified and EAC3To is only applying a default in one method and not the other.

(That's the cause of most of my recent problems with MakeMKV.)
Sounds possible. I've got to do a bit more experimentation. It isn't a file size problem - I inserted a 'trim (0,4315)' just before soundout, so that the clip would only be 3 minutes long and less than 100 mb in size - no change.

(brief pause)

I think you're on to something. Here's the mediainfo dump of the good version:
General
Complete name : file2.wav
Format : Wave
File size : 4.10 GiB
Duration : 2h 7mn
Overall bit rate mode : Constant
Overall bit rate : 4 608 Kbps

Audio
Format : PCM
Format settings, Endianness : Little
Format settings, Sign : Signed
Codec ID : 00001000-0000-0100-8000-00AA00389B71
Duration : 2h 7mn
Bit rate mode : Constant
Bit rate : 4 608 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Stream size : 4.10 GiB (100%)

Notice there is a channel layout specified here.
Or it's sending the wrong 5.1 layout to the encoder... another thing MakeMKV has been doing until recently.
...or the channel layout is in a non-standard format and thus incomprehensible to the Aften dll. My guess now is that the layout is missing, and in eac3to the default layout is applied by the .wav writer.

I think I have enough info now to know which forum to take this to now. No point in trying to get soundout fixed. Maybe Madshi can help.

However - if anyone has any more/better ideas, I'd love to hear them.