Help - Search - Members - Calendar
Full Version: Foobar fails to correctly encode large files
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Support - (fb2k)
jaybeee
PC is running XPsp2 on an AMD Athlon 64 Processor 3000+, 1gb RAM

The original wav file:
CODE
foobar v0.8.3 special info:

Original file:
bitrate = 1411
samplerate = 44100
channels = 2
codec = PCM
bitspersample = 16
--------------------
635299244 samples @ 44100Hz

Length: 4:00:05.878

Foobar reported file size: -1,753,770,276 Bytes (2423.47 MB) <--- not sure why it reports this as minus 1??
Win XP sp2 reported file size: 2,541,197,020 Bytes (2.36 GB)
To clarify, this is a large wav file of just over 4hrs in duration with a file size of approx 2.4gb

I used four different 'methods' of trying to encode this file into a FLAC, Ogg Vorbis & mp3 (LAME) file.

Encoding 'methods' used:
foobar v0.8.3
foobar v0.9.2b4
'drops': lamedropXPd.exe (V2.0 with 3.97b2) :: oggdropXPd.exe (1.8.9 with libvorbis 1.1.2) :: FlacDrop.exe (V1.2 with FLAC 1.1.2)
Command line running of the LAME, Ogg Vorbis & FLAC exe's.

Versions & switches used (unless where specified, i.e. oggdropXPd.):
mp3: LAME 3.97b2 :: -V2 --vbr-new
Ogg Vorbis: oggenc283_sse2_lancer20060529 :: -q4
FLAC: 1.1.2 :: --best -V

---

Results:

==== foobar 0.8.3 ====

LAME:
CODE

INFO (CORE) : startup time: 1500 ms
INFO (CORE) : opening file for playback :
INFO (CORE) : location: "file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\file.wav" (0)
INFO (foo_out_dsound_ex) : Created stream: 44100Hz 16bps 2ch
INFO (foo_clienc) : CLI encoder: C:\My Downloads\Encoders\lame\lame 3.97b2\lame.exe
INFO (foo_clienc) : Destination file: file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\file.mp3
INFO (foo_clienc) : Source file: file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\file.wav
INFO (foo_clienc) : 44100Hz 24bps 2ch
INFO (foo_clienc) : Encoding took 503016 milliseconds, speed 16.13x
ERROR (foo_diskwriter) : Conversion failed.

---

Resulting file:
File size: 163,163,802 Bytes (155.61 MB)
Length: 2:15:15.000

Tech Info:
lame_version = LAME3.97
lame_profile =
lame_profile_index = 0
enc_delay = 576
enc_padding = 1332
mp3_accurate_length = yes
bitrate = 161
codec = MP3
channels = 2
samplerate = 44100
extrainfo = VBR
mp3_stereo_mode = joint stereo

357871500 samples @ 44100Hz
(mod 588 = 0)



Ogg Vorbis:
CODE

INFO (CORE) : opening file for playback :
INFO (CORE) : location: "file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\file.wav" (0)
INFO (foo_out_dsound_ex) : Created stream: 44100Hz 16bps 2ch
INFO (foo_clienc) : CLI encoder: C:\My Downloads\Encoders\ogg\oggenc283_sse2_lancer20060529\oggenc2.exe
INFO (foo_clienc) : Destination file: file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\file.ogg
INFO (foo_clienc) : Source file: file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\file.wav
INFO (foo_clienc) : 44100Hz 32bps 2ch
ERROR (foo_clienc) : Writing to encoder failed
INFO (foo_clienc) : Encoding took 204907 milliseconds, speed 29.70x
ERROR (foo_diskwriter) : Conversion failed.

---

Resulting file:
File size: 85,831,414 Bytes (81.86 MB)
Length: 1:41:26.000

Tech Info:
bitrate = 113
channels = 2
samplerate = 44100
bitrate_nominal = 128
codec = Vorbis
vorbis_vendor = BS; Lancer(SSE2) [20060529] (based on aoTuV b4b [20051117])

268392600 samples @ 44100Hz



FLAC:
CODE

INFO (foo_clienc) : CLI encoder: C:\My Downloads\Encoders\flac\flac 1.1.2\flac.exe
INFO (foo_clienc) : Destination file: file://C:\Audio\lossless\flac\Non Commercial\file.flac
INFO (foo_clienc) : Source file: file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\file.wav
INFO (foo_clienc) : 44100Hz 16bps 2ch
INFO (foo_clienc) : Encoding took 1223687 milliseconds, speed 11.77x

---

Resulting file:
File size: 1,257,970,356 Bytes (1199.69 MB)
Length: 3:22:53.000

Tech Info:
FLAC_vendor = reference libFLAC 1.1.2 20050205
bitrate = 827
samplerate = 44100
channels = 2
bitspersample = 16
codec = FLAC
    
536829300 samples @ 44100Hz




==== foobar 0.9.2b4 =====


LAME:
CODE

Error writing to file (Encoder has terminated prematurely with code 0; please re-check parameters) : file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\test file\file.mp3

---

Resulting file:
File size: 163,185,039 Bytes (155.63 MB)
Length: 2:15:15.962

Tech Info:
lame_version = LAME3.97
lame_profile =
lame_profile_index = 0
enc_delay = 576
enc_padding = 1523
mp3_accurate_length = yes
bitrate = 161
codec = MP3
channels = 2
samplerate = 44100
extrainfo = VBR
mp3_stereo_mode = joint stereo

357913933 samples @ 44100Hz
(rounded samples : 357913836)



Ogg Vorbis:
CODE

Error writing to file (Encoder has terminated prematurely with code 0; please re-check parameters) : file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\test file\foobar 0.9.4 converted\file.ogg

---

Resulting file:
File size: 115,247,651 Bytes (109.91 MB)
Length: 2:15:15.962

Tech Info:
bitrate = 114
channels = 2
samplerate = 44100
bitrate_nominal = 128
codec = Vorbis
vorbis_vendor = BS; Lancer(SSE2) [20060529] (based on aoTuV b4b [20051117])

357913933 samples @ 44100Hz



FLAC:
CODE

.::. foobar did not report an error with this convertion, but the file was not correct .::.

---

Resulting file:
File size: 1,258,058,161 Bytes (1199.78 MB)
Length: 3:22:53.943

Tech Info:
FLAC_vendor = reference libFLAC 1.1.2 20050205
bitrate = 827
samplerate = 44100
channels = 2
bitspersample = 16
codec = FLAC

536870900 samples @ 44100Hz




==== 'Drops' ====


LAME:
CODE
Ran successfully, with no errors

---

Resulting file:
File size: 297,906,724 Bytes (284.11 MB)
Length: 4:00:05.878

Tech Info:
lame_version = LAME3.97
lame_profile =
lame_profile_index = 0
enc_delay = 576
enc_padding = 1684
mp3_accurate_length = yes
bitrate = 165
codec = MP3
channels = 2
samplerate = 44100
extrainfo = VBR
mp3_stereo_mode = joint stereo

635299244 samples @ 44100Hz
(rounded samples : 635298720)


Ogg Vorbis:
CODE
Ran successfully, with no errors

---

Resulting file:
File size: 200,754,234 Bytes (191.45 MB)
Length: 4:00:05.878

Tech Info:
bitrate = 111
channels = 2
samplerate = 44100
bitrate_nominal = 128
codec = Vorbis
vorbis_vendor = Xiph.Org libVorbis I 20050304

635299244 samples @ 44100Hz


FLAC:
CODE
Ran successfully, with no errors

---

Resulting file:
File size: 1,484,715,685 Bytes (1415.94 MB)
Length: 4:00:05.878

Tech Info:
FLAC_vendor = reference libFLAC 1.1.2 20050205
bitrate = 825
samplerate = 44100
channels = 2
bitspersample = 16
codec = FLAC

635299244 samples @ 44100Hz


==== Command Line ====

LAME:
CODE
Ran successfully, with no errors

---

Resulting file:
File size: 297,906,665 Bytes (284.11 MB)
Length: 4:00:05.878

Tech Info:
lame_version = LAME3.97
lame_profile =
lame_profile_index = 0
enc_delay = 576
enc_padding = 1684
mp3_accurate_length = yes
bitrate = 165
codec = MP3
channels = 2
samplerate = 44100
extrainfo = VBR
mp3_stereo_mode = joint stereo

635299244 samples @ 44100Hz
(rounded samples : 635298720)


Ogg Vorbis:
CODE
Ran successfully, with no errors

---

Resulting file:
File size: 207,977,860 Bytes (198.34 MB)
Length: 4:00:05.878

Tech Info:
bitrate = 115
channels = 2
samplerate = 44100
bitrate_nominal = 128
codec = Vorbis
vorbis_vendor = BS; Lancer(SSE2) [20060529] (based on aoTuV b4b [20051117])

635299244 samples @ 44100Hz


FLAC:
CODE
Ran successfully, with no errors

---

Resulting file:
File size: 1,484,715,685 Bytes (1415.94 MB)
Length: 4:00:05.878

Tech Info:
FLAC_vendor = reference libFLAC 1.1.2 20050205
bitrate = 825
samplerate = 44100
channels = 2
bitspersample = 16
codec = FLAC

635299244 samples @ 44100Hz


---

Conclusion:
foobar cannot correctly convert my file.
The 'drop' frontends and the use of the command line does work.

---

I found out all this after I'd discovered a bug with wavegain. I posted that in this thread. john33 had a look and confirmed a bug in the code citing:

the use of "signed long ints in a couple of places where they should be unsigned"
and
the use of "functions 'fseek' and 'ftell' when closing the file to ensure that any chunks that appear after the 'data' chunk are copied over, and both of these functions use signed ints!! Hence, the often seen 2GB limit!! I've circumvented this issue by using '_fseeki64' and '_ftelli64' which, as the names suggest, are similar functions, but use signed 64 bit ints. Oddly, these 64 bit functions are completely undocumented regarding their existence."

See this thread too.

---

So, I thought I'd create this looong (sorry) post in the hope of highlighting a problem presumably with foobar or foo_diskwriter / foo_converter ???

---
EDIT: meant to say 0.9.2b4 and not 0.9.4
kjoonlee
Something similar has been discussed before.

Are you passing samples as 16bit or 24bit samples? If "highest BPS supported" is 24, try setting it to 16 for large files.
jaybeee
QUOTE(kjoonlee @ Jun 8 2006, 01:49) *

Something similar has been discussed before.

Are you passing samples as 16bit or 24bit samples? If "highest BPS supported" is 24, try setting it to 16 for large files.
Nope, 16-bit only. Doing it at 24 fails straight away with foobar versions, with no file being created. The problem above fails part way through the convertion process, with a file created, but not at the correct length.

This is a genuine problem imo that I've reported in order for the Dev team to have a look at.
kjoonlee
*shrug* Seemed similar to me.

Anyway, on a second look, your logs for 0.8.3 show that some files are being passed as 24bit or 32bit.
jaybeee
QUOTE(kjoonlee @ Jun 8 2006, 07:16) *

*shrug* Seemed similar to me.

Anyway, on a second look, your logs for 0.8.3 show that some files are being passed as 24bit or 32bit.
That's ok mate.

And you're right about the foobar 0.8.3 logs:
LAME: INFO (foo_clienc) : 44100Hz 24bps 2ch
Ogg Vorbis: INFO (foo_clienc) : 44100Hz 32bps 2ch

However, it is not set up like that in my foobar diskwriter preferences. I don't actually think I've ever used a greater bit depth than 16-bit. Plus, I use the same 'preference' when encoding on mass my flac CD files. So I know for sure that the settings I use do work. But seemingly on this large file they are not happy.


kjoonlee
Lossless FLAC images are nowhere near 2 gigs in size, so I guess that's expected.

With foo_clienc or the lossy converter presets, foobar2000 passes data in the highest bitdepth that the command-line encoder can handle, AFAIK. It's not related to "Output bit depth" which only governs lossless/uncompressed bitdepth.
prawns
QUOTE(jaybeee @ Jun 7 2006, 22:06) *
==== foobar 0.9.4 ====
He's from the future! laugh.gif
jaybeee
If I use foobar to encode say a 1gb wav file into mp3 (LAME), Ogg Vorbis or FLAC, it works fine.
Using the exact same settings, it fails with the file that has originated these issues.
So surely by that rationale, foobar is having problems with this large file.

If "foobar2000 passes data in the highest bitdepth that the command-line encoder can handle" then I assume the use of the command line does NOT do that? Otherwise the command line encodes would've failed too right?

Whilst I understand more than the average joe about digital encoding, my techie knowledge is at it's limit right now. I'm failing to understand why foobar would want to up the bitdepth if the use of the same encoder at the command line does not do that (maybe I'm wrong here anyway??).

So, is there a way to adjust foobar so that the bit-depth passed in is 16-bit? I still don't get why it would increase the bit-depth when the file being passed in is only 16-bits anyway.

@prawns: laugh.gif ooops, I'll change it to 0.9.2b4
kjoonlee
You are correct. The command-line encoder you invoke from the command line takes the .wav file as is, in its original 16bit form.

foobar2000 does not pass the original .wav file to the encoder, but passes it as a "bit stream," although you can tell foobar2000 to pass it as a temporary file. But then, the temporary file is not the same as the original .wav file.

The workaround to this problem would be to edit the converter presets (or make new custom ones) and limit the "highest BPS supported" to 16.

jaybeee
^^ ok, thanks for the info. I'll give it a go and see what happens.

By the fact you say "the workaround to this problem" implies that this is a problem with foobar though. If it's been discussed before and foobar dev decided it wasn't worth doing anything with it, then fine. If not, I'd be interested to see what they say.

Whilst I now understand why foobar errors, I just don't think it should; I'm not attempting to do anything out of the ordinary here.

thanks for the help
kjoonlee
I was trying to give the impression that maybe the command-line encoders were to blame. I don't know the *real* problem or the real solution. unsure.gif
jaybeee
QUOTE(kjoonlee @ Jun 8 2006, 12:10) *

I was trying to give the impression that maybe the command-line encoders were to blame. I don't know the *real* problem or the real solution. unsure.gif
oops, ok.

I think we need some foobar devs and/or encoder devs to chip in on this thread. Anyone wanna put me right & shut me up tongue.gif or confirm a problem?
jaybeee
QUOTE(kjoonlee @ Jun 8 2006, 10:09) *
The workaround to this problem would be to edit the converter presets (or make new custom ones) and limit the "highest BPS supported" to 16.

As you suggested kjoonlee, I've amended the 'Highest BPS mode supported' from 24 to 16 for LAME & Ogg Vorbis (I had to uncheck the 'pass floating point data' checkbox for the Ogg Vorbis preset in foobar 0.8.3). I did this in both foobar versions 0.8.3 & 0.9.2b4. I don't think I've ever amended these before, and as I said above, I've never had this issue of a file failing to be encoded by foobar before.

Anyway, here are my findings:

Results:

==== foobar 0.8.3 [take 2] ====

LAME:

CODE
INFO (CORE) : opening file for playback :
INFO (CORE) : location: "file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\test file\file.wav" (0)
INFO (foo_out_dsound_ex) : Created stream: 44100Hz 16bps 2ch
INFO (foo_out_dsound_ex) : Created stream: 44100Hz 16bps 2ch
INFO (foo_clienc) : CLI encoder: C:\My Downloads\Encoders\lame\lame 3.97b2\lame.exe
INFO (foo_clienc) : Destination file: file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\test file\foobar 0.8.3 converted 2\file.mp3
INFO (foo_clienc) : Source file: file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\test file\file.wav
INFO (foo_clienc) : 44100Hz 16bps 2ch
INFO (foo_clienc) : Encoding took 755172 milliseconds, speed 16.11x
ERROR (foo_diskwriter) : Conversion failed.


Resulting file:
File size: 251,326,970 Bytes (239.68 MB)
Length: 3:22:53.000

Tech Info:
lame_version = LAME3.97
lame_profile =
lame_profile_index = 0
enc_delay = 576
enc_padding = 2124
mp3_accurate_length = yes
bitrate = 165
codec = MP3
channels = 2
samplerate = 44100
extrainfo = VBR
mp3_stereo_mode = joint stereo

536829300 samples @ 44100Hz
(mod 588 = 0)


Ogg Vorbis:

CODE
INFO (CORE) : startup time: 968 ms
INFO (foo_clienc) : CLI encoder: C:\My Downloads\Encoders\ogg\oggenc283_sse2_lancer20060529\oggenc2.exe
INFO (foo_clienc) : Destination file: file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\test file\file.ogg
INFO (foo_clienc) : Source file: file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\test file\file.wav
INFO (foo_clienc) : 44100Hz 16bps 2ch
ERROR (foo_clienc) : Writing to encoder failed
INFO (foo_clienc) : Encoding took 371953 milliseconds, speed 32.72x
ERROR (foo_diskwriter) : Conversion failed.

Resulting file:
File size: 175,568,594 Bytes (167.44 MB)
Length: 3:22:53.000

Tech Info:
bitrate = 115
channels = 2
samplerate = 44100
bitrate_nominal = 128
codec = Vorbis
vorbis_vendor = BS; Lancer(SSE2) [20060529] (based on aoTuV b4b [20051117])

536829300 samples @ 44100Hz


---

==== foobar 0.9.2b4 [take 2] ====

LAME:

CODE
Error writing to file (Encoder has terminated prematurely with code 0; please re-check parameters) : file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\test file\foobar 0.9.2b4 converted 2\file.mp3

Resulting file:
File size: 251,348,784 Bytes (239.70 MB)
Length: 3:22:53.943

Tech Info:
lame_version = LAME3.97
lame_profile =
lame_profile_index = 0
enc_delay = 576
enc_padding = 1996
mp3_accurate_length = yes
bitrate = 165
codec = MP3
channels = 2
samplerate = 44100
extrainfo = VBR
mp3_stereo_mode = joint stereo

536870900 samples @ 44100Hz
(rounded samples : 536870460)



Ogg Vorbis:

CODE
Error writing to file (Encoder has terminated prematurely with code 0; please re-check parameters) : file://C:\Audio\lossless\flac\Non Commercial\_To Be Sorted\test file\foobar 0.9.2b4 converted 2\file.ogg

Resulting file:
File size: 175,586,342 Bytes (167.45 MB)
Length: 3:22:53.943

Tech Info:
bitrate = 115
channels = 2
samplerate = 44100
bitrate_nominal = 128
codec = Vorbis
vorbis_vendor = BS; Lancer(SSE2) [20060529] (based on aoTuV b4b [20051117])

536870900 samples @ 44100Hz


I didn't need to run FLAC again as it's setting was already at 16.

So there still seems to be a problem. And all the files now fail at 3hrs 22mins 53secs: not sure why that is??? However, that was also the same time that the file failed with wavegain 1.2.6.

There's still a problem here me thinks. Can anyone else confirm this? Any fb2k Dev wanna take a look at this?

Cheers

jaybeee
jaybeee
QUOTE(jaybeee @ Jun 8 2006, 20:28) *
Any fb2k Dev wanna take a look at this?

Cheers

jaybeee

kjoonlee
Uncompressed 44.1kHz 16bit stereo files have a bitrate of 1411200bps, or 176400bytes per second.

3 hours 22 minutes 52 seconds mean 12172 seconds.

Multiply the bitrate with the approximate playtime and you get the approximage stream size, which is around 2147140800.

This looks dangerously close to 2147483647, 2 gigs.

Programs *should* be able to handle 4 gigs on 32bit architectures, but they usually can't.

http://www.hydrogenaudio.org/forums/index....showtopic=32422
jaybeee
QUOTE(kjoonlee @ Jun 25 2006, 10:30) *

Uncompressed 44.1kHz 16bit stereo files have a bitrate of 1411200bps, or 176400bytes per second.

3 hours 22 minutes 52 seconds mean 12172 seconds.

Multiply the bitrate with the approximate playtime and you get the approximage stream size, which is around 2147140800.

This looks dangerously close to 2147483647, 2 gigs.

Programs *should* be able to handle 4 gigs on 32bit architectures, but they usually can't.

http://www.hydrogenaudio.org/forums/index....showtopic=32422
Yep, I know that wink.gif

But is that simply enough for foobar? Is foobar gonna be constrained by that? If so, fair enough, but a response from fb2k dev would be nice, that's all.

I'm only ytrying to be helpful and report a 'bug' I found
sld
QUOTE(cliveb @ Mar 17 2005, 17:35) *

QUOTE(ChiGung @ Mar 17 2005, 03:40 AM)
The common wav header can only allocate 4 bytes to state the total wav length in bytes which will be why there's a two Gig limit.
*


This isn't quite correct. It is true that the file length in the WAV header is a 4 byte integer, but it's an *unsigned* number, which means that the maximum size of a WAV file is actually 4GB, not 2GB.

Some audio programs get this wrong, and interpret the file length as a signed number, thus imposing a 2GB limit. I can confirm that Wave Repair supports WAV files up to 4GB, and if used just for recording it's free. And I see someone else has pointed out that Audacity (also free) will also go above 2GB.


From the thread linked by kjoonlee. biggrin.gif
If this is a 'bug' in foobar OR the commandline encoders then there seems to be no reason why it cannot be corrected.

Offtopic: I finally used the multiquote toggle correctly for the first time.
kjoonlee
There's another thread at the Vorbis forums: not possible to encode a 3.5GB wave file.

jaybeee, could you please check if using "oggenc < in.wav" like in the thread above works for 3gig files?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.