lordmulder / LameXP

Audio Encoder Front-End
http://lordmulder.github.io/LameXP
Other
184 stars 18 forks source link

Multichannel to Stereo option error. #43

Closed BiatuAutMiahn closed 7 years ago

BiatuAutMiahn commented 7 years ago

When using "Enforce Stereo Downmix of Surround (Multi-Channel) Sources" along with "Enforce HE-AAC v2 (AAC + SBR + PS)" on an AAC/MP4 encoding, the encoder fails when the input is not multi-channel. NeroAAC complains that it cannot parse the wav file, and it seems the the wav is zero'd when the utility that does the multi-channel to stereo conversion completes with a result of 0, and a multichannel stream is not found.

lordmulder commented 7 years ago

Hello.

Not quite sure what's happening. The "Enforce Stereo Downmix of Surround (Multi-Channel) Sources" option will downmix multi-channel (i.e. more than two channels) inputs to Stereo before they are sent to the encoder; it is a NOP (i.e. it does nothing) for Stereo or Mono inputs. So, whether that option is enabled does not make a difference for Mono/Stereo sources; it does make any difference (only) for multi-channel.

Anyhow, the one and only difference between "HE-AAC (AAC + SBR)" and "HE-AAC v2 (AAC + SBR + PS)" is that the latter uses a feature called "Parametric Stereo" (PS), which the former doesn't use. The idea of PS is that the encoder will downmix the Stereo source to Mono prior to the actual encoding; and the decoder is going to re-create some kind of "fake" Stereo signal from that again. This intended for ultra-low bitrates!

Obviously, using PS (and thus using HE-AAC v2) only makes sense for Stereo sources. It cannot work for Mono sources. Indeed, NeroAAC will fail with error, if you try to force HE-AAC v2, but feed it with a Mono input. Probably that is what was actually causing your problem? (more Details needed to clearify)

(Hint: You don't want to force HE-AAC v2, or HE-AAC in general. The encoder would to that automatically)

Regards, MuldeR


BTW: When posting this kind of error reports, please always say which exact version of LameXP you are using. Also it is always a good idea to attach the log of the job that has failed!

BiatuAutMiahn commented 7 years ago

Ok, I did test this multiple times, and when using the "Enforce Stereo Downmix of Surround (Multi-Channel) Sources" option, when there is no multi-channel source I think lxp_sox.exe is zeroing the wav file.

I am using the beta, v4.14 RC-5 Build 1926 (Also tested this on the latest stable)

Two different input files: https://www2.iis.fraunhofer.de/AAC/SBRtestStereoAot5Sig1.mp4 (Stereo) https://www2.iis.fraunhofer.de/AAC/ChID-BLITS-EBU-Narration.mp4 (MultiChannel)

Output for MultiChannel

LameXP v4.14 (Build #1926), compiled on 2016-11-05 at 13:17:43

-------------------------------

C:/Users/Biatu/AppData/Local/Temp/0b1af496c7e20510/lxp_faad.exe -o C:\Temp\1bc0727f2fbc2f24.wav C:\Users\Biatu\Desktop\ChID-BLITS-EBU-Narration.mp4

*********** Ahead Software MPEG-4 AAC Decoder V2.7 ******************
Build: Oct 27 2012
Copyright 2002-2004: Ahead Software AG
http://www.audiocoding.com
Floating point version
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License.
**************************************************************************
C:\Users\Biatu\Desktop\ChID-BLITS-EBU-Narration.mp4 file info:
LC AAC 46.603 secs, 6 ch, 44100 Hz
tool: Fraunhofer IIS MPEG-4 Audio Encoder 03.02.11.01_MPEGScbr_SXPro
---------------------
| Config: 5.1 Ch | WARNING: channels are reordered according to
--------------------- MS defaults defined in WAVE_FORMAT_EXTENSIBLE
| Ch | Position |
---------------------
| 00 | Center front |
| 01 | Left front |
| 02 | Right front |
| 03 | Left back |
| 04 | Right back |
| 05 | LFE |
---------------------
Decoding C:\Users\Biatu\Desktop\ChID-BLITS-EBU-Narration.mp4 took: 0.45 sec. 102.88x real-time.

Exited with code: 0x0000

-------------------------------

C:/Users/Biatu/AppData/Local/Temp/0b1af496c7e20510/lxp_sox.exe --i C:\Temp\1bc0727f2fbc2f24.wav

Input File : 'C:\Temp\1bc0727f2fbc2f24.wav'
Channels : 6
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:46.58 = 2054144 samples = 3493.44 CDDA sectors
File Size : 24.6M
Bit Rate : 4.23M
Sample Encoding: 16-bit Signed Integer PCM

Exited with code: 0x0000

-------------------------------

--> Number of channels is: 6

C:/Users/Biatu/AppData/Local/Temp/0b1af496c7e20510/lxp_sox.exe -V3 -S --guard --temp . C:\Temp\1bc0727f2fbc2f24.wav C:\Temp\481c82244a49bcde.wav remix 1v0.4,3v0.2,4v0.2,5v0.2 2v0.4,3v0.2,4v0.2,6v0.2

C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe: SoX v14.4.2
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO formats: detected file format type `wav'
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO wav: EXTENSIBLE
Input File : 'C:\Temp\1bc0727f2fbc2f24.wav'
Channels : 6
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:46.58 = 2054144 samples = 3493.44 CDDA sectors
File Size : 24.6M
Bit Rate : 4.23M
Sample Encoding: 16-bit Signed Integer PCM
Endian Type : little
Reverse Nibbles: no
Reverse Bits : no
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: Overwriting `C:\Temp\481c82244a49bcde.wav'
Output File : 'C:\Temp\481c82244a49bcde.wav'
Channels : 2
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:46.58 = 2054144 samples = 3493.44 CDDA sectors
Sample Encoding: 16-bit Signed Integer PCM
Endian Type : little
Reverse Nibbles: no
Reverse Bits : no
Comment : 'Processed by SoX'
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: effects chain: input 44100Hz 6 channels
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: effects chain: remix 44100Hz 2 channels
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: effects chain: gain 44100Hz 2 channels
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: effects chain: dither 44100Hz 2 channels
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: effects chain: output 44100Hz 2 channels
Done.

Exited with code: 0x0000

-------------------------------

C:/Users/Biatu/AppData/Local/Temp/0b1af496c7e20510/lxp_sox.exe -V3 -S --guard --temp . C:\Temp\481c82244a49bcde.wav C:\Temp\71ec4894a84c0c9f.wav rate -h -L 44100 dither -s

C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe: SoX v14.4.2
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO formats: detected file format type `wav'
Input File : 'C:\Temp\481c82244a49bcde.wav'
Channels : 2
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:46.58 = 2054144 samples = 3493.44 CDDA sectors
File Size : 8.22M
Bit Rate : 1.41M
Sample Encoding: 16-bit Signed Integer PCM
Endian Type : little
Reverse Nibbles: no
Reverse Bits : no
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: Overwriting `C:\Temp\71ec4894a84c0c9f.wav'
Output File : 'C:\Temp\71ec4894a84c0c9f.wav'
Channels : 2
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:46.58 = 2054144 samples = 3493.44 CDDA sectors
Sample Encoding: 16-bit Signed Integer PCM
Endian Type : little
Reverse Nibbles: no
Reverse Bits : no
Comment : 'Processed by SoX'
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO rate: has no effect in this configuration
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO dither: has no effect in this configuration
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: effects chain: input 44100Hz 2 channels
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: effects chain: gain 44100Hz 2 channels
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: effects chain: output 44100Hz 2 channels
Done.

Exited with code: 0x0000

-------------------------------

"C:/Program Files (x86)/MuldeR/LameXP v4.13/neroAacEnc.exe" -q 0.20 -hev2 -if C:\Temp\71ec4894a84c0c9f.wav -of "C:\Users\Biatu\Desktop\Drivers\Users\Biatu\Desktop\ChID-BLITS-EBU-Narration (3).mp4"

*************************************************************
* *
* Nero AAC Encoder *
* Copyright 2009 Nero AG *
* All Rights Reserved Worldwide *
* *
* Package build date: Feb 18 2010 *
* Package version: 1.5.4.0 *
* *
* See -help for a complete list of available parameters. *
* *
*************************************************************

Exited with code: 0x0000`

And output for Stereo:
`LameXP v4.14 (Build #1926), compiled on 2016-11-05 at 13:17:43

-------------------------------

C:/Users/Biatu/AppData/Local/Temp/0b1af496c7e20510/lxp_faad.exe -o C:\Temp\08b9638703956a07.wav C:\Users\Biatu\Desktop\SBRtestStereoAot5Sig1.mp4

*********** Ahead Software MPEG-4 AAC Decoder V2.7 ******************
Build: Oct 27 2012
Copyright 2002-2004: Ahead Software AG
http://www.audiocoding.com
Floating point version
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License.
**************************************************************************
C:\Users\Biatu\Desktop\SBRtestStereoAot5Sig1.mp4 file info:
HE AAC 32.817 secs, 2 ch, 44100 Hz
tool: Fraunhofer IIS MPEG-4 Audio Encoder 03.02.11.01_MPEGScbr_SXPro
---------------------
| Config: 2 Ch |
---------------------
| Ch | Position |
---------------------
| 00 | Left front |
| 01 | Right front |
---------------------

Exited with code: 0x0000

-------------------------------

C:/Users/Biatu/AppData/Local/Temp/0b1af496c7e20510/lxp_sox.exe --i C:\Temp\08b9638703956a07.wav

Input File : 'C:\Temp\08b9638703956a07.wav'
Channels : 2
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:32.79 = 1445888 samples = 2458.99 CDDA sectors
File Size : 5.78M
Bit Rate : 1.41M
Sample Encoding: 16-bit Signed Integer PCM

Exited with code: 0x0000

-------------------------------

--> Number of channels is: 2

Skipping downmix!

-------------------------------

C:/Users/Biatu/AppData/Local/Temp/0b1af496c7e20510/lxp_sox.exe -V3 -S --guard --temp . C:\Temp\d9ab9d4e62b2d3d5.wav C:\Temp\e464709fdaf234bf.wav rate -h -L 44100 dither -s

C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe: SoX v14.4.2
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe FAIL formats: can't open input file `C:\Temp\d9ab9d4e62b2d3d5.wav': WAVE: RIFF header not found

Exited with code: 0x0002

-------------------------------

"C:/Program Files (x86)/MuldeR/LameXP v4.13/neroAacEnc.exe" -q 0.20 -hev2 -if C:\Temp\d9ab9d4e62b2d3d5.wav -of C:\Users\Biatu\Desktop\Drivers\Users\Biatu\Desktop\SBRtestStereoAot5Sig1.mp4

ERROR: could not parse WAV file
*************************************************************
* *
* Nero AAC Encoder *
* Copyright 2009 Nero AG *
* All Rights Reserved Worldwide *
* *
* Package build date: Feb 18 2010 *
* Package version: 1.5.4.0 *
* *
* See -help for a complete list of available parameters. *
* *
*************************************************************

Exited with code: 0x0001`

Now after disabling the "Enforce Stereo Downmix of Surround (Multi-Channel) Sources"...

MultiChannel:

LameXP v4.14 (Build #1926), compiled on 2016-11-05 at 13:17:43

-------------------------------

C:/Users/Biatu/AppData/Local/Temp/0b1af496c7e20510/lxp_faad.exe -o C:\Temp\804bffcbf3915de9.wav C:\Users\Biatu\Desktop\ChID-BLITS-EBU-Narration.mp4

*********** Ahead Software MPEG-4 AAC Decoder V2.7 ******************
Build: Oct 27 2012
Copyright 2002-2004: Ahead Software AG
http://www.audiocoding.com
Floating point version
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License.
**************************************************************************
C:\Users\Biatu\Desktop\ChID-BLITS-EBU-Narration.mp4 file info:
LC AAC 46.603 secs, 6 ch, 44100 Hz
tool: Fraunhofer IIS MPEG-4 Audio Encoder 03.02.11.01_MPEGScbr_SXPro
---------------------
| Config: 5.1 Ch | WARNING: channels are reordered according to
--------------------- MS defaults defined in WAVE_FORMAT_EXTENSIBLE
| Ch | Position |
---------------------
| 00 | Center front |
| 01 | Left front |
| 02 | Right front |
| 03 | Left back |
| 04 | Right back |
| 05 | LFE |
---------------------

Exited with code: 0x0000

-------------------------------

C:/Users/Biatu/AppData/Local/Temp/0b1af496c7e20510/lxp_sox.exe --i C:\Temp\804bffcbf3915de9.wav

Input File : 'C:\Temp\804bffcbf3915de9.wav'
Channels : 6
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:46.58 = 2054144 samples = 3493.44 CDDA sectors
File Size : 24.6M
Bit Rate : 4.23M
Sample Encoding: 16-bit Signed Integer PCM

Exited with code: 0x0000

-------------------------------

C:/Users/Biatu/AppData/Local/Temp/0b1af496c7e20510/lxp_sox.exe -V3 -S --guard --temp . C:\Temp\804bffcbf3915de9.wav C:\Temp\5e62a7e14bd5ef77.wav rate -h -L 44100 dither -s

C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe: SoX v14.4.2
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO formats: detected file format type `wav'
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO wav: EXTENSIBLE
Input File : 'C:\Temp\804bffcbf3915de9.wav'
Channels : 6
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:46.58 = 2054144 samples = 3493.44 CDDA sectors
File Size : 24.6M
Bit Rate : 4.23M
Sample Encoding: 16-bit Signed Integer PCM
Endian Type : little
Reverse Nibbles: no
Reverse Bits : no
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: Overwriting `C:\Temp\5e62a7e14bd5ef77.wav'
Output File : 'C:\Temp\5e62a7e14bd5ef77.wav'
Channels : 6
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:46.58 = 2054144 samples = 3493.44 CDDA sectors
Sample Encoding: 16-bit Signed Integer PCM
Endian Type : little
Reverse Nibbles: no
Reverse Bits : no
Comment : 'Processed by SoX'
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO rate: has no effect in this configuration
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO dither: has no effect in this configuration
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: effects chain: input 44100Hz 6 channels
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: effects chain: gain 44100Hz 6 channels
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: effects chain: output 44100Hz 6 channels
Done.

Exited with code: 0x0000

-------------------------------

"C:/Program Files (x86)/MuldeR/LameXP v4.13/neroAacEnc.exe" -q 0.20 -hev2 -if C:\Temp\5e62a7e14bd5ef77.wav -of "C:\Users\Biatu\Desktop\Drivers\Users\Biatu\Desktop\ChID-BLITS-EBU-Narration (5).mp4"

ERROR: Unsupported encoding configuration
*************************************************************
* *
* Nero AAC Encoder *
* Copyright 2009 Nero AG *
* All Rights Reserved Worldwide *
* *
* Package build date: Feb 18 2010 *
* Package version: 1.5.4.0 *
* *
* See -help for a complete list of available parameters. *
* *
*************************************************************

Exited with code: 0x0001`

And Stereo:
`LameXP v4.14 (Build #1926), compiled on 2016-11-05 at 13:17:43

-------------------------------

C:/Users/Biatu/AppData/Local/Temp/0b1af496c7e20510/lxp_faad.exe -o C:\Temp\450a228df0dd49c0.wav C:\Users\Biatu\Desktop\SBRtestStereoAot5Sig1.mp4

*********** Ahead Software MPEG-4 AAC Decoder V2.7 ******************
Build: Oct 27 2012
Copyright 2002-2004: Ahead Software AG
http://www.audiocoding.com
Floating point version
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License.
**************************************************************************
C:\Users\Biatu\Desktop\SBRtestStereoAot5Sig1.mp4 file info:
HE AAC 32.817 secs, 2 ch, 44100 Hz
tool: Fraunhofer IIS MPEG-4 Audio Encoder 03.02.11.01_MPEGScbr_SXPro
---------------------
| Config: 2 Ch |
---------------------
| Ch | Position |
---------------------
| 00 | Left front |
| 01 | Right front |
---------------------

Exited with code: 0x0000

-------------------------------

C:/Users/Biatu/AppData/Local/Temp/0b1af496c7e20510/lxp_sox.exe --i C:\Temp\450a228df0dd49c0.wav

Input File : 'C:\Temp\450a228df0dd49c0.wav'
Channels : 2
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:32.79 = 1445888 samples = 2458.99 CDDA sectors
File Size : 5.78M
Bit Rate : 1.41M
Sample Encoding: 16-bit Signed Integer PCM

Exited with code: 0x0000

-------------------------------

C:/Users/Biatu/AppData/Local/Temp/0b1af496c7e20510/lxp_sox.exe -V3 -S --guard --temp . C:\Temp\450a228df0dd49c0.wav C:\Temp\e40ba784cdb5b144.wav rate -h -L 44100 dither -s

C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe: SoX v14.4.2
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO formats: detected file format type `wav'
Input File : 'C:\Temp\450a228df0dd49c0.wav'
Channels : 2
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:32.79 = 1445888 samples = 2458.99 CDDA sectors
File Size : 5.78M
Bit Rate : 1.41M
Sample Encoding: 16-bit Signed Integer PCM
Endian Type : little
Reverse Nibbles: no
Reverse Bits : no
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: Overwriting `C:\Temp\e40ba784cdb5b144.wav'
Output File : 'C:\Temp\e40ba784cdb5b144.wav'
Channels : 2
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:32.79 = 1445888 samples = 2458.99 CDDA sectors
Sample Encoding: 16-bit Signed Integer PCM
Endian Type : little
Reverse Nibbles: no
Reverse Bits : no
Comment : 'Processed by SoX'
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO rate: has no effect in this configuration
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO dither: has no effect in this configuration
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: effects chain: input 44100Hz 2 channels
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: effects chain: gain 44100Hz 2 channels
C:\Users\Biatu\AppData\Local\Temp\0b1af496c7e20510\lxp_sox.exe INFO sox: effects chain: output 44100Hz 2 channels
Done.

Exited with code: 0x0000

-------------------------------

"C:/Program Files (x86)/MuldeR/LameXP v4.13/neroAacEnc.exe" -q 0.20 -hev2 -if C:\Temp\e40ba784cdb5b144.wav -of C:\Users\Biatu\Desktop\Drivers\Users\Biatu\Desktop\SBRtestStereoAot5Sig1.mp4

*************************************************************
* *
* Nero AAC Encoder *
* Copyright 2009 Nero AG *
* All Rights Reserved Worldwide *
* *
* Package build date: Feb 18 2010 *
* Package version: 1.5.4.0 *
* *
* See -help for a complete list of available parameters. *
* *
*************************************************************

Exited with code: 0x0000`

And for further debugging, I wrote a simple script that will copy every wav file in the temp directory that LameXP produces, and I see that a valid wave exists until lxp_sox.exe does not detect a multichannel stream.

lordmulder commented 7 years ago

Can you please use Gist for posting such long logs, or at least use proper formatting? https://help.github.com/articles/creating-and-highlighting-code-blocks/


Anyhow, I identified and (hopefully) fixed another problem: When an audio filter is skipped – e.g. the "downmix" filter is skipped when the source is already Mono or Stereo – the filter did not write an output file. But the main "processing" thread was assuming that a filter always created an output file, if it didn't fail. Skipped filters were not handled specially. So, LameXP tried to continue with the projected output file, even if filter had been skipped. This means, in that case, we tried to encode from an empty file – which failed.

I also fixed -hev2 option for NeroAAC encoder, when the source is not Stereo (will revert to -he now).

Please try with the new version: https://sourceforge.net/projects/lamexp/files/Snapshots%20%28BETA%29/2016-11-12/LameXP-RC6.2016-11-12.Release-Static.Build-1930.exe/download

BiatuAutMiahn commented 7 years ago

I do apologize for that formatting, I did use the 'insert code' command in the post, but it didn't seem to work, but the post is fixed now.

The new build works perfectly.

lordmulder commented 7 years ago

Thank you for confirming that the fix is working!