View Full Version : Issues with foobar2000 making 5.1ch 24/96 FLACs...
Blue_MiSfit
18th January 2007, 06:54
Hey everyone.
I've been using foobar2000 a lot recently to make FLACs of my CD collection. When I am working with high quality uncompressed 24/96 5.1ch sources ripped from my DVD audio version of the Grateful Dead's American Beauty album, foobar won't let me make a FLAC - it gives me the error
Error writing to file (Encoder has terminated prematurely with code 1; please re-check parameters) : file://F:\beauty_wavs\1 01.flac
Very strange. Possibly related to the unusually high bit depth sampling rate and channel mapping? I was under the impression that FLAC could handle just about anything. Maybe foobar is to blame?
Interestingly, when I first downmix and resample these 5.1 24/96 WAVs to 2.0 16/48 using foobar's DSP (to later encode to ALAC for my iPod), the encode runs happily. Even stranger, the FLAC is only 8% smaller than the equivalent WAV. What's up with that?
Pookie
18th January 2007, 07:46
Just to rule it out, how about outputting to a CLI encoder and using Flake to flac (hee hee). Don't delete your source files if it works - I believe Flake isn't 100% lossless. Could be a bug you've discovered? BTW, what are you using for the DSP chain in foobar ?
http://win32builds.sourceforge.net/flake/index.html
Blue_MiSfit
18th January 2007, 08:21
I managed to narrow it down a bit. In foobar, Stereo 24 bit 96 KHz (5.1 to stereo converter) works fine, but 5.1 (no DSP filters) still does not.
With flake, 5.1 24 bit 96 KHz is converted to 16 bit: note, damn that's fast! Looks like flake is just an optimized FLAC encoder? Strangely, although the output file plays fine in foobar, it crashes Winamp! I have the latest flac decoder installed for Winamp, 1.1.3. Does flake have a special modified bitstream or something? Note that when comparing md5sum of successive flake generations, the result is the same, so after the 24->16 conversion at least it is lossless.
C:\Documents and Settings\Misfit\Desktop\flake-svn-r114-bin\flake-svn-r114-bin\e
xe_pgo_p3>flake f:\beauty_wavs\01.wav -o f:\beauty_wavs\01.flac
Flake: FLAC audio encoder
(c) 2006 Justin Ruggles
block time: 105ms
variable block size: none
prediction type: levinson-durbin
prediction order: 1,8
partition order: 0,6
order method: estimate
header padding: 4096
input file: "f:\beauty_wavs\01.wav"
output file: "f:\beauty_wavs\01.flac"
Signed 24-bit 96000 Hz 6-channel
WARNING! converting to 16-bit (not lossless)
samples: 30733920 (5m20.145s)
block size: 8192
progress: 100% | ratio: 0.292 | bitrate: 4035.6 kbps | bytes: 161436940
C:\Documents and Settings\Misfit\Desktop\flake-svn-r114-bin\flake-svn-r114-bin\e
xe_pgo_p3>
Pookie
18th January 2007, 08:38
I'm trying DTS to Flac and it seems to be working for me. DTS plugin for foobar is dated 7-22-06. flac.exe is dated 2-3-05. Not completed yet, though.
Note - the .DTS file is 16/48 :(
Betcha it is bit depth or sample rate. I'll convert the file to 24/96 multich wav and try it in a bit....
Yong
18th January 2007, 08:42
OT: flake is based on ffmpeg flac encoder,
the author is justin(same author as eften).
Both encoding speed and efficiency are almost same and still an experimental encoder,
but ffmpeg flac encoder much "buggier".
@Blue_MiSfit:
u will receive more help if u post at hydrogenaudio.org as well ;)
Blue_MiSfit
18th January 2007, 08:54
Another problem cropping up now... It seems that using the simple 5.1 to stereo DSP in foobar destroys the audio - I get all sorts of dreadful clipping... Probably something bad in the downmix? I tried bringing the source into Sound Forge, thinking it would offer more options, but sadly it doesn't support 6ch wav...
Ideas? I would rather NOT rip the alternate 2ch mix on the DVD-A...
Pookie
18th January 2007, 09:33
I tried converting/resampling with
Tranzcode x.dts /mch /24 /96000
which resulted in a wav file that foobar didn't like at all. Probably my sound card doesn't support it.
Even converting to 16/48000 resulted in the Chimpmunk effect when played through foobar, and a silent flac file.
-------------------------------------------------------------------------------------------------------------
You could separate the tracks with tranzcode or with multiwav by jsoto http://jsoto.posunplugged.com/tools/multiwav_1001_exe.zip
Resample with either SSRC_HP.exe 2pass operation, or r8brain (which is supposed to be pretty good) www.voxengo.com
Dunno how the dithering/resampling algos are in Soundforge, but I'll betcha there's a VST or DirectX plugin that'll work as an alternative to the above. ssrc_hp is slow, and you'll have to do 1 track at a time.
Dither VST plugin http://mda.smartelectronix.com/effects.htm (also look at the instruction guide which you can download)
Blue_MiSfit
19th January 2007, 09:06
I went ahead and re-ripped the 2ch pcm mix - I figured the sound engineer knew what he was doing better than I :)
It opened happily in sound forge, and I did a max quality resample to 48 KHz at best quality and anti aliasing(max for iPod), and changed the bit depth to 16 with dithering and noise shaping. Resulting 2ch 16/48 WAV was then encoded to Apple Lossless (ALAC), and sounds great on my iPod!
I still need to get the 6ch 24/96 sources into FLAC... Any other ideas on this?
Pookie
19th January 2007, 09:49
It'll probably end up being something simple and obvious, Blue_MiSfit. Another spectacular recent music release is the 5.1 audio DVD of that little 60s band from Liverpool ;) DTS as well as AC3, and they separated the instruments and voices, including sound effects, background vocals, etc. Fun playing with the track levels on that one.
Blue_MiSfit
21st January 2007, 04:32
I hope so! Has anyone been able to successfully encode 24/96 5.1ch FLACs??
Pookie
21st January 2007, 06:57
http://flac.sourceforge.net/faq.html#general__channels
"FLAC supports from 1 to 8 channels per stream. Channels are only grouped in FLAC to take advantage of interchannel correlation and to define common channel assignments (like stereo L/R, 5.1 surround, et cetera). When encoding a large number of independent channels it is expected that they are coded separately and if required, multiplexed together in a suitable container like Ogg or Matroska."
I wonder if that means demuxing the MC wave/dts, encoding each mono track to FLAC, then muxing to MKA or OGG
http://forum.doom9.org/showthread.php?p=893834
http://www.hydrogenaudio.org/forums/index.php?showtopic=45326&pid=399535&mode=threaded&show=&st=0&#entry399535
"currently, except for mono and stereo, channel assignments are undefined. you can store 6-8 independent channels but should take care to note the order somehow. I plan to add some surround mappings for the next release in september but might not get to it with all the other stuff."
tebasuna51
21st January 2007, 13:29
Has anyone been able to successfully encode 24/96 5.1ch FLACs??
Yes:
6c_24b_96kH.wav -> Encode -> output.flac -> Decode -> output.wav (bit-identical to original)
Encode methods:
1) Foobar2000 v0.9.4.1b1
2) FLAC Frontend v1.7.1
3) Command line flac v1.1.2
4) Also with Bepipe:
bepipe.exe --script "WavSource(^6_24_96b.wav^)" | flac - -o output.flac
Don't try with BeHappy because all wav's are changed to 16 bit.
Blue_MiSfit
22nd January 2007, 00:32
tebasuna: That's exactly what I've tried to do - albeit with a slightly newer version of Foobar2000 - 0.9.4.2... It refuses to encode 5.1 flac - see my previous posts. I have also tried using flake... I will try bepipe later tonight :)
Thanks
~MiSfit
tebasuna51
22nd January 2007, 02:56
Foobar2000 v0.9.4.2 works also for me.
Really bepipe method is only to test flac.exe standard input.
Is enough test command line method:
flac.exe input.wav -o output.flac
Blue_MiSfit
22nd January 2007, 07:06
01.wav: WARNING: legacy WAVE file has format type 1 but bits-per-sample=24
01.wav: ERROR: WAVE has >2 channels but is not WAVE_FORMAT_EXTENSIBLE; cannot as
sign channels
Is the result of flac.exe - so it looks like I need to remux my WAV files into a newer version of the WAV container or something along those lines??
~MiSfit
Pookie
22nd January 2007, 13:48
Tebasuna has a command line app that might work for that message:
http://ul46.rapidshare.com/files/3572747/WavUtil.zip
##############################################################################
WavNotEx v1.0.0.1: Patch/Correct WAVE_FORMAT_EXTENSIBLE header (Tebasuna 2006)
##############################################################################
Usage:
WavNotEx [-p] [-q] <input.wav>
Where:
-p the wav with WAVE_FORMAT_EXTENSIBLE header is 'patched' to be accepted
for old audio soft replacing wFormatTag with 2 first bytes of SubFormat.
If -p not exist, a wav 'patched' recover the original wFormatTag value.
-q quiet mode.
tebasuna51
22nd January 2007, 16:15
The problem is new (buggy?) version 1.1.3:
flac 1.1.3, Copyright (C) 2000,2001,2002,2003,2004,2005,2006 Josh Coalson
...
6_24_96.wav: WARNING: legacy WAVE file has format type 1 but bits-per-sample=24
6_24_96.wav: ERROR: WAVE has >2 channels but is not WAVE_FORMAT_EXTENSIBLE; cannot assign channels
Remain with flac v1.1.2 or use WaveWizard to convert to WAVE_FORMAT_EXTENSIBLE, but;
flac 1.1.3, Copyright (C) 2000,2001,2002,2003,2004,2005,2006 Josh Coalson
...
6_24_96.wav: ERROR: WAVEFORMATEXTENSIBLE chunk with unsupported channel mask=0x0000
Wavewizard don't put a valid channel mask, then with WinHex at Offset 0x28 put 0x3F (ChannelMask= FL,FR,C,LFE,SL,SR) and now work OK:
flac 1.1.3, Copyright (C) 2000,2001,2002,2003,2004,2005,2006 Josh Coalson
...
6_24_96.wav: wrote 2672641 bytes, ratio=0,077
The new flac version only accept 24/96 with correct WAVE_FORMAT_EXTENSIBLE header.
@Pookie, my patch is just inverse: make readable WAVE_FORMAT_EXTENSIBLE for old soft.
Pookie
23rd January 2007, 03:54
"@Pookie, my patch is just inverse: make readable WAVE_FORMAT_EXTENSIBLE for old soft."
:o lol
Blue_MiSfit
23rd January 2007, 05:11
@tebasuna51: the evaluation version of WinHex doesn't support writing files over 200kb (mine is ~ 550 MB :)). Can you suggest an equally good hex editor?
Flac 1.1.2 does indeed work fine on the original sources... though I would like to use the latest and greatest whenever possible :D
~MiSfit
tebasuna51
23rd January 2007, 12:19
If you have runtime libraries Visual Basic 5, maybe you can use this old little app I wrote: GrabaBin (http://www.mytempdir.com/1181552)
To modify ChannelMask you can use:
GrabaBin.exe /B 41_63 /F filename_without_quotes
Blue_MiSfit
23rd January 2007, 15:32
thanks!
jruggle
24th January 2007, 04:48
I managed to narrow it down a bit. In foobar, Stereo 24 bit 96 KHz (5.1 to stereo converter) works fine, but 5.1 (no DSP filters) still does not.
With flake, 5.1 24 bit 96 KHz is converted to 16 bit: note, damn that's fast! Looks like flake is just an optimized FLAC encoder? Strangely, although the output file plays fine in foobar, it crashes Winamp! I have the latest flac decoder installed for Winamp, 1.1.3. Does flake have a special modified bitstream or something? ...
Hi,
I wrote Flake. 24-bit encoding is on the TODO list, but right now does downsample to 16-bit. As far as Winamp crashing...that's really odd. It should not be doing that, especially with the settings you used, which do not utilize any of Flake's experimental stuff. My guess is that the issue is Winamp since Foobar decodes okay. But then again, Flake has not been through very vigorous testing at early this stage in its existance.
Anyway, it seems that your only choice for now to encode 24-bit is the libFLAC encoder...I just wanted to chime in and say that I'm working on adding it to Flake sometime in the future.
-Justin
Blue_MiSfit
24th January 2007, 04:58
jruggle - Thanks for the work on Flake! More encoders is always better. I've finally got a bunch of 5.1 24/96 FLACs that sound incredible (obviously), and have over 2:1 compression!
~MiSfit
madshi
30th June 2007, 22:26
Hi Justin,
just a quick question: Are there any size limits with the Windows builds of your Flake encoder? I'm talking about both WAV input size and FLAC output size. For movie sound track compression we need virtually unlimited sizes (> 4GB input/output).
Also I was wondering whether you've had any time to add 24bit encoding support?
Thanks much!
Wilbert
28th July 2007, 16:22
@Blue_MiSfit,
Did you solve the error message in your first post? I tried both with flac 1.1.3b and 1.2.0a and get the same error message in foobar with multichannel stuff.
@tebasuna51,
Could you give me the encoding preset for encoding 5.1 wav to 5.1 flac. I tried "-s -5 - -o %d", but apparently it doesn't work in this case.
tebasuna51
28th July 2007, 18:11
@tebasuna51,
Could you give me the encoding preset for encoding 5.1 wav to 5.1 flac. I tried "-s -5 - -o %d", but apparently it doesn't work in this case.
This preset work for me with Flac.exe 1.1.2 (217.088 bytes 2005-02-04), with 1.1.3 and 1.1.4 Flac require WAVE_FORMAT_EXTENSIBLE header with correct ChannelMask and I don't know how can Foobar send this wav header.
Use BeHappy (the data are passed in raw format) or convert 5.1 wav to WAVE_FORMAT_EXTENSIBLE with WaveWizard and set the correct ChannelMask with WinHex or GrabaBin (see my precedent post)
Wilbert
20th August 2007, 14:49
@tebasuna51,
Could you do something for me? I've a 96kHz 24bit 5.1ch wav here:
http://www.savefile.com/files/986990
I can convert it to FLAC using the FLAC frontend (i'm using FLAC 1.2.0 here).
I'm able to play it in Foobar 0.9.4.3, but i can't convert it to FLAC with Foobar. It gives the same error message as in the first post of this thread. (I'm using the standard preset, as described in my last post.) Do you have the same problem when converting it to FLAC with Foobar?
Kurtnoise
20th August 2007, 15:23
@Wilbert : why not trying an other lossless encoder first ? Then, you can convert your stream in FLAC losslessly..
SoleBastard
20th August 2007, 22:06
This behavior was introduced with Flac 1.1.3. I already complained about it here @HA.org (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=50667&view=findpost&p=454541) but apparently it is regarded as 'user abuse' by the flac/foobar2000 developers.
This is the 'fix' though:
-s -8 - -o %d --channel-map=none
and this is the resulting file with your (@Wilbert) test sample:
klik mij ;)! (http://www.savefile.com/files/987951)
The sample is rather weird, the voice channel mapping does not correspond at all with my surround set up.
Wilbert
20th August 2007, 23:23
This behavior was introduced with Flac 1.1.3. I already complained about it here @HA.org but apparently it is regarded as 'user abuse' by the flac/foobar2000 developers.
This is the 'fix' though:
-s -8 - -o %d --channel-map=none
Thanks, i will try it!
The sample is rather weird, the voice channel mapping does not correspond at all with my surround set up.
Strange, the resulting FLAC should have the correct order (namely the same as the WAV). Could you tell me what the order of the FLAC clip is, and if the channel order of the FLAC and WAV clips are indeed the same?
SoleBastard
20th August 2007, 23:44
Well, the WAV file is already wrong:
Front Left = Front Left
Front Center = Rear Left
Front Right = Front Right
Rear Left = Rear Center
Rear Right = Sub woofer
Sub woofer = Sub woofer (can't really understand what he's saying)
The Flac file is corresponding with the (wrong) WAV file.
I'm using Foobar2000 (24bit, no DSPs), Audigy 2 ZS and Gigaworks 7.1
tebasuna51
21st August 2007, 02:51
@Wilbert
Your wav file is WAVE_FORMAT_EXTENSIBLE and is accepted by Flac 1.2 in command line:
Flac t9624.wav
Don't worry with the warning, is correct:
WARNING: skipping unknown sub-chunk 'fact'
But is not accepted by STDIN:
type t9624.wav | flac - -o output.flac
with:
WARNING: skipping unknown sub-chunk ' '
WARNING: skipping unknown sub-chunk ' '
...
ERROR during read while skipping unsupported sub-chunk
But converted to standard header (not WAVE_FORMAT_EXTENSIBLE) works with:
type t9624_not_ex.wav | flac - -o ouput.flac --channel-map=none
Really a useful 'fix' this undocumented feature.
BTW, your wav is wrong channel mapped: FL, FR, BL, BR, C, LFE and must be FL, FR, C, LFE, BL, BR
And of course the flac is wrong also.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.