Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Foobar FLAC multichannel encoder problem. (Read 2943 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Foobar FLAC multichannel encoder problem.

Hi,
I have .MLP (dvd-audio) files that are 96/24 and 4.1 channels (without the center channel). I can't convert them to Flac in Foobar. I can convert 5.1, 5.0, 4.0 and 2.0 files but not 4.1! I managed to convert .MLPs to .Wavs but still can't convert those 4.1 wavs to flacs. 
Strangely (or not) I managed to convert those 4.1 wavs to 4.1 flacs using dBPowerAmp.
Thanks in advance.

Re: Foobar FLAC multichannel encoder problem.

Reply #1
Add  --channel-map=none to FLAC command line parameters in fb2k's converter.

Re: Foobar FLAC multichannel encoder problem.

Reply #2
FLAC expects 5 channel material to use front left, front right, front center, back/surround left, back/surround right channels. Source: https://xiph.org/flac/format.html#frame_header, see Channel assignment.
The FLAC encoder reports the following error with your source material:
Quote
ERROR: WAVEFORMATEXTENSIBLE chunk with unsupported channel mask=0x003B

Use --channel-map=none option to encode the input
You can create a custom FLAC profile and add that --channel-map=none parameter to the command line.
Forgive my laziness for not checking the source to know everything that parameter does, but from the name it sounds like it leaves channel configuration undefined. But in reality it seems to just make FLAC support all channel layouts and store the correct layout in a tag. If that is the case the parameter is confusing and I don't understand why it's not the default behavior.

Re: Foobar FLAC multichannel encoder problem.

Reply #3
Thank you both. It "almost" worked but now I think that LFE channels became Center. Is there a way to check/see which channels are in use in foobar - not just 5ch but their names - FL, FR, C, BL, BR, LFE/SUB or similar?

Edit:
When I listen to those files with MPC-HC or VLC the channels are ok - L, R, SUB, BL, BR.
But when I listen to those files with Foobar or Kodi the SUB channel is playing in Center speaker!

Re: Foobar FLAC multichannel encoder problem.

Reply #4
The channel layout is mentioned on the Details tab of the Properties dialog. I hope you aren't using some old foobar2000 version, there have been channel layout related fixes. And if you update the player you may need to force it to reload the info to get the fixed layout in use.

Re: Foobar FLAC multichannel encoder problem.

Reply #5
The channel layout is mentioned on the Details tab of the Properties dialog. I hope you aren't using some old foobar2000 version, there have been channel layout related fixes. And if you update the player you may need to force it to reload the info to get the fixed layout in use.
I use 1.6.12 . The Details tab of the properties only mentions 5 channels without their actual layout.

Edit:
I have some 4.0 files and 5.0 files and the Details tab shows 4: FL FR BL BR or 5: FL FC FR BL BR but with those 4.1 files it only shows 5 (without channels names) and with 5.1 files it also shows only 6 (no channels names).

Re: Foobar FLAC multichannel encoder problem.

Reply #6
The channel layout isn't shown for regular 5 channel FLAC where the layout is as per the spec. But when the channels are in custom order the layout is properly shown by foobar2000 v1.6.12:
Quote
Channels: 5: FL FR LFE BL BR
Either something goes wrong with your encoding or something mystical happens.

Re: Foobar FLAC multichannel encoder problem.

Reply #7
How original MLP files are playing in fb2k and what channels are displayed for them in properties?

Re: Foobar FLAC multichannel encoder problem.

Reply #8
For "debugging": What happens if you
1) convert them to WavPack, and try those files
2) convert the WavPack files to FLAC and try those?

Re: Foobar FLAC multichannel encoder problem.

Reply #9
How original MLP files are playing in fb2k and what channels are displayed for them in properties?

MLP files display only 5 channels in foobar (no names in properties). And:
-MLP files play - wrong in Foobar and right in MPCHC, VLC and KODI
- Converted to WAV shows 5: FL FR LFE BL BR in properties but LFE plays in Center channel in Foobar. VLC shows 2FR/LFE. MPCHC shows 5 channels (no names) and plays wrong. Kodi plays wrong.

So I re-ripped my DVD-a to wav (not to MLP). WAVS show proper channels in Foobar but can't be recoded to flac:
1 out of 1 files converted with major problems.

Source: "D:\000 empajer\dark pars 4.1\track-01-01[1]-02-[Lf-Rf-LFE-Ls-Rs]-24-96000.wav"
  Destination: "D:\000 empajer\dark pars 4.1\track-01-01[1]-02-[Lf-Rf-LFE-Ls-Rs]-24-96000.flac"
  An error occurred while writing to file (The encoder has terminated prematurely with code 1 (0x00000001); please re-check parameters) : "D:\000 empajer\dark pars 4.1\track-01-01[1]-02-[Lf-Rf-LFE-Ls-Rs]-24-96000.flac"
  Additional information:
  Encoder stream format: 96000Hz / 5ch / 24bps
  Command line: "C:\Program Files (x86)\foobar2000\aflac-1.3.4-win\win64\flac.exe" -s --ignore-chunk-sizes -5 - -o "track-01-01[1]-02-[Lf-Rf-LFE-Ls-Rs]-24-96000.flac"
  Working folder: D:\000 empajer\dark pars 4.1\
  Conversion failed: The encoder has terminated prematurely with code 1 (0x00000001); please re-check parameters

So I re-ripped my DVD-a again using different program, now directly to flac (but using old ver. 1.2.1) and it shows correct channels in Foobar.
But both files (wav and flac) play wrong in foobar.....but flac plays ok in MPCHC and wav plays wrong in MPCHC.
I am really confused now.

Re: Foobar FLAC multichannel encoder problem.

Reply #10
MLP files display only 5 channels in foobar (no names in properties)
So this is decoder problem, not fb2k itself, and it leads to wrong encoding to FLAC. I guess you are using foo_input_dvda to play and convert mlp files?

So I re-ripped my DVD-a to wav (not to MLP). WAVS show proper channels in Foobar but can't be recoded to flac:
Command line: "C:\Program Files (x86)\foobar2000\aflac-1.3.4-win\win64\flac.exe" -s --ignore-chunk-sizes -5 - -o "track-01-01[1]-02-[Lf-Rf-LFE-Ls-Rs]-24-96000.flac"
You forgot to add  --channel-map=none

BTW, if fb2k shows correct channels in file properties, then playback in fb2k should also be correct. Are you sure, you know what real channels layout your source files have?

Re: Foobar FLAC multichannel encoder problem.

Reply #11
For "debugging": What happens if you
1) convert them to WavPack, and try those files
2) convert the WavPack files to FLAC and try those?

I converted all 3 types (my old MLP; new (todays) wav and new (todays) flac) to wavpack - all three wavpack files show proper channels but all three play wrong in foobar. But all three play ok in MPCHC and KODI!!!

Re: Foobar FLAC multichannel encoder problem.

Reply #12
MLP files display only 5 channels in foobar (no names in properties)
So this is decoder problem, not fb2k itself, and it leads to wrong encoding to FLAC. I guess you are using foo_input_dvda to play and convert mlp files?

So I re-ripped my DVD-a to wav (not to MLP). WAVS show proper channels in Foobar but can't be recoded to flac:
Command line: "C:\Program Files (x86)\foobar2000\aflac-1.3.4-win\win64\flac.exe" -s --ignore-chunk-sizes -5 - -o "track-01-01[1]-02-[Lf-Rf-LFE-Ls-Rs]-24-96000.flac"
You forgot to add  --channel-map=none

I use dvd-a input to play MLP but I decided to convert all my MLPs to flac. I convert MLP to flac using foobar converter and flac 1.4.1 from xiph.
I did not add --channel-map=none just to show you the error message. I used it earlier - the files were converted but played wrongly.

I am sure my files are with LFE and without Center - I heard them from DVD-A disc and you can see the channel layout in the names of the ripped files track-01-01[1]-02-[Lf-Rf-LFE-Ls-Rs]-24-96000.flac Those names are made automatically while ripping - not manually by me.
Those are the only files I have ever had problems with. So I guess the problem lays in 4.1 (5.0 and 4.0 were always ok). But I managed to play them correctly using MPCHC and KODI (using wavpack) so the problem is only with foobar - it either does not recognize channel layout or even when it does it plays it differently, confusing LFE with Center.

Just to be precise:
my other (properly playing) 5 channel files, which are 5.0 show 5: FL FR FC BL BR in foobar and play exactly those channels.
But my todays problematc files which are also 5 channel (but not 5.0 - they are 4.1) and were reripped again to wav, flac, mlp or converted to wavpack - all show 5 FL FR LFE BL BR in foobar but all play Center and not LFE. So my guess is...foobar can't properly play 4.1 files, it probably thinks it should be 5.0.
Maybe tomorrow I will make my own 4.1 files from some mono channels and see if it will play properly in different programs (foobar, vls, kodi, mpchc).
Right now I was able to properly play wavpack files in MPC but not in Foobar.
And I only hear bass guitar in the center channel so it is LFE for sure.

Re: Foobar FLAC multichannel encoder problem.

Reply #13
I use dvd-a input to play MLP but I decided to convert all my MLPs to flac. I convert MLP to flac using foobar converter and flac 1.4.1 from xiph.
I did not add --channel-map=none just to show you the error message. I used it earlier - the files were converted but played wrongly.

One more time: your mlp files are encoded to FLAC by fb2k incorrectly because it is foo_input_dvda that outputs wrong channels layout, not because of --channel-map=none

Re: Foobar FLAC multichannel encoder problem.

Reply #14
I use dvd-a input to play MLP but I decided to convert all my MLPs to flac. I convert MLP to flac using foobar converter and flac 1.4.1 from xiph.
I did not add --channel-map=none just to show you the error message. I used it earlier - the files were converted but played wrongly.

One more time: your mlp files are encoded to FLAC by fb2k incorrectly because it is foo_input_dvda that outputs wrong channels layout, not because of --channel-map=none
I have just written that I re ripped my DVD-a disc using two different programs to do it. I ripped the disc directly to wav and to flac. No foobar nor dvd-a input involved. I also recoded mlp, wav and flac to wavpack - in foobar but I guess no dvd-a input was invlved in flac and wav conversion. And all those files show proper channel layout now but all play wrong in foobar. I guess foobar does not use dvd-a input to play wavpack, wav or flac.

Re: Foobar FLAC multichannel encoder problem.

Reply #15
Folks: 4.1 is not easy it seems - is there any straightforward way to script the following with ffmpeg or otherwise:
FOR all *.mlp files do:
* check the channel allocation
* if channel allocation is 4.1, make it 5.1 with a silent FC
?


@wojak , do you have ffmpeg in there? ffmpeg can convert from MLP:

ffmpeg -i infile outfile.wv

Do those behave any different?

If you want to keep them as WavPack, then recompress later with official WavPack (then you get the WavPack 5 file format too), but for now it is just for debugging.



Re: Foobar FLAC multichannel encoder problem.

Reply #16
Seems like fb2k does incorrect upmixing when playing 4.1 audio signal to 6-channel audio device with default output mode.

Re: Foobar FLAC multichannel encoder problem.

Reply #17
I seem unable to replicate incorrect playback. Here's a 4.1 channel test file. Downmixed from 5.1 channel source so it says "center" using front left and right speakers. I hear LFE even when center speaker's wires are unplugged.

Re: Foobar FLAC multichannel encoder problem.

Reply #18
I seem unable to replicate incorrect playback. Here's a 4.1 channel test file. Downmixed from 5.1 channel source so it says "center" using front left and right speakers. I hear LFE even when center speaker's wires are unplugged.

Hi, I just listened to your test file and:
- MPCHC plays: FL, FR, both fronts (with word "center"), SUB, RL, RR
- Foobar plays: FL, FR, both fronts (with word "center"), Center and SUB (both at the same time), RL, RR. Maybe there is something wrong with my foobar - but I never changed anything concerning channel mappig there. I tested it on 2 different laptops (so two different foobars - both 1.6.12). It really seems Foobar problem (or my Foobar problem) and not any encoder/decoder - MPCHC plays it right.

Concerning "I hear LFE even when center speaker's wires are unplugged." - I hear LFE in Center Speaker (if SUB is turned off) and I hear LFE in both SUB and Center Speaker when both are connected. So FL, FR, RL, RR and SUB are ok but Center plays Center and Sub at the same time. But only in foobar and only with my yesterdays files and your test file - so only with 4.1 file. All other channel configurations (2.0, 4.0, 5.0, 5.1)  never seemed wrong.

 

Re: Foobar FLAC multichannel encoder problem.

Reply #19
Folks: 4.1 is not easy it seems - is there any straightforward way to script the following with ffmpeg or otherwise:
FOR all *.mlp files do:
* check the channel allocation
* if channel allocation is 4.1, make it 5.1 with a silent FC
?


@wojak , do you have ffmpeg in there? ffmpeg can convert from MLP:

ffmpeg -i infile outfile.wv

Do those behave any different?

If you want to keep them as WavPack, then recompress later with official WavPack (then you get the WavPack 5 file format too), but for now it is just for debugging.




After some reading and lots of experiments my conculusions are:
Foobar plays well my 2.0, 4.0 and 5.1 files but it plays 4.1 and 5.0 files wrong.
My 5.0 files play like fake 5.1, there is something in my SUB - it is hard to say what but I think it is the Center channel duplicated.
My 4.1 files play like fake 5.1 the LFE channel is duplicated in Center speaker.
It does not matter if the files are mlp, wav, wavpack or flac.
MPC-HC player plays 5.0 files and 4.1 files properly if they have proper channel layout (the text in properties must be saying 5 and the names of channels; if there is only 5 and no channels names MPC-HC behaves like foobar - duplicates the fifth channel, because it does not know which one it is LFE or Center). And it  (MPC-HC) plays those files properly if they are mlp, wavpack, and flac but wrong if they are wavs.
I use windows10, foobar1.6.12, "wasapi" exclusive, HDMI, Onkyo AVR to play multichannel. When playing 4.0 my AVR shows 4 channels working, but when playing 5.0 or 4.1 it shows 6 channels (with 5 properly working  and the 6th silent in from MPC-HC and with duplicated channel form foobar).
I can't test multichannel ASIO because I only have stereo USB DAC with ASIO - but it is always ok in stereo.
So what I think is that foobar does not properly recognise 5 channels audio and duplicates LFE/Center.
From what I have read similar problems may occur with 3.0 or 2.1 files or other non-common layouts - but I do not have such files to test it.
It would be great if the problem was solved (I think it is foobar bug and not any decoder problem) but if it can't - is there an easy way to enter a totally silent channel (LFE or Center) to 4.1/5.0 file without manipulating the existing audio (losslessly)? Or is there a way for foobar to play that additional channel without changing the file and output audio (losslessly)?