Using Flac for commercial use at my site I'm offering 24/96 files of my classical releases for sale, I apologize if I explain the problem like a novice about Flac because I am a novice about using Flac so excuse me.
I'm using Flac for compression because almost all of my clients prefer it, first off my wav files average between 150 to 600mb not compressed I'm using a dedicated server to store them and I'm using a php based cart software my programmer is having a hard time trying to figure out why when you buy through the cart software and download the file and try to play the file on some players such as media monkey it works but on others like VLC it doesn't also when you try to decode the file off the Flac frontend you get a out of sync error message now on the other hand when you use a ftp client to download the file everything works fine, well I'm wondering if anybody has any experience with this situation because it is very frustrating.
Can the php cart be adding any tags to the file ???
FYI the files that go through the software cart come down off the server at the same size as the file when it is on the server so it is not being cut off as it is being downloaded.
Hope I explained it so you guys understand any help would be greatly appreciated
Thanks
jcoalson
Apr 5 2007, 16:14
if you can save the flac file after each of the those different mechanisms and compare them, that will tell you if anything is getting modified. if it's the same as the original, you can try the command line flac program in test mode (flac -t) to test it or use one of the other flac testers:
http://www.vuplayer.com/other.phphttp://www.neilpopham.pwp.blueyonder.co.uk/flac-test.batit's also possible that some other program has added an id3 tag on the FLAC file which is a no-no.
Josh
Synthetic Soul
Apr 6 2007, 01:22
I'm confused by the fact that both the source and downloaded file are the same size. Are you talking bytes or just duration? I suspect that the software is adding a header to the file due to the wrong content type being used.
One suggestion to help us diagnose: create a small FLAC file, download it via the cart software, and then upload both files for us to download.
Josh could find the change in a jiffy, but any one of us may be able to help.
Have you tried comparing them in a hex editor? Have you tried using multiple browsers?
evereux
Apr 6 2007, 03:17
QUOTE(Synthetic Soul @ Apr 6 2007, 08:22)

I'm confused by the fact that both the source and downloaded file are the same size. Are you talking bytes or just duration? I suspect that the software is adding a header to the file due to the wrong content type being used.
That was my guess or white space being appended (output buffer issues in PHP, see ob_start etc).
HDTT, The file comparison is essential in trouble shooting this.
Thanks for all the help
I've put up 2 identical flac files on my server one is called original.flac and the other fromphpcart.flac the latter is the file off of the shopping cart which I'm having problems and the other is the original file for comparison
again if anybody could tell me what's up with them it would be greatly appreciated here is the address:
http://01688cb.netsolhost.com/public/
...Just Elliott
Apr 6 2007, 11:21
Oh come on, they're 90MB. Something smaller that I can use md5 on and download before I die of old age?
evereux
Apr 6 2007, 12:08
The "fromphpcart.flac" has 0D0A 0D0A at the beginning and a 0D0A at the end. Your PHP script is almost certainly the culprit.
edit: ps they're not the same size.
Synthetic Soul
Apr 6 2007, 12:35
I had the benefit of putting my daughter to bed while I waited.
There are four extra bytes at the beginning: 13, 10, 13, 10 (CRLF, CRLF)
There are two extra bytes at the end: 13, 10 (CRLF)
The page that is pushing the download must be writing these CRLF combos as well.
Edit: ... the benefit of the time to download, but not the good sense to check the thread before responding.
How exactly is the PHP reading the file and sending it? Can we see some PHP code?
It almost sounds like the file is being sent as some kind of malformed HTTP response. The headers are empty, and the FLAC is the body.
pepoluan
Apr 9 2007, 00:32
I agree with sbooth.
The HTTP standard says that (IIRC) an HTTP transfer is composed of the http version<crlf>HTTP headers<crlf><crlf>body.
I think PHP generates the necessary headers, but in this regard instead of using 2 <crlf>'s uses 3 <crlf>'s. Then, it appends 1 <crlf> at the end of the body. With HTML files, it's no problem (they'rs <crlf>-agnostic). With binaries, chaos.
I know sometimes with PHP if have a gap between the start of the file and the <?php or after the ?> can casue extra characters to go along for the ride.
Is there a way to elliminate the gaps before uploading??
Something like this should work:
CODE
<?php
header('Content-type: application/octet-stream');
readfile('music.flac');
?>
or whatever the right content type for .flacs is. No guarantee though...
edit: "Content-type: audio/x-flac" seems to be the right one.
Synthetic Soul
Apr 9 2007, 13:22
QUOTE(HDTT @ Apr 9 2007, 19:43)

Is there a way to elliminate the gaps before uploading??
The "gaps" are not in the FLAC file, but caused by the PHP script which pushes the download.
You need to look to the PHP code - the FLAC files are fine.
Michael Luster
Apr 12 2007, 09:59
I'm the programmer working on this issue. Here's the source PHP:
(This is the source file currently used.)
header ("Pragma: private");
header ("Expires: " . $now);
header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header ("Cache-Control: private, must-revalidate");
header ("Content-Description: File Transfer");
header ("Content-Type: audio/x-flac");
header ("Accept-Ranges: bytes");
header ("Content-Disposition: attachment; filename=" . $this->fileName);
header ("Content-Transfer-Encoding: binary");
header ("Content-Length: " . filesize ($this->fullFilePath));
$handle = fopen ($this->fullFilePath, 'rb');
while (!feof ($handle)) {
print (fread ($handle, 1024*8));
flush ();
ob_flush ();
}
fclose ($handle);
As to the note below, I really don't know why, I'm just trying to fix what was previously written.
pepoluan
Apr 12 2007, 12:00
Um, I'm a bit unclear. Is this the solution to the problem above?
Slightly OT: Why use $now for expiration? As the FLAC file most likely will not change in the near future, why not use a future date?
Synthetic Soul
Apr 12 2007, 12:29
QUOTE(pepoluan @ Apr 12 2007, 19:00)

Um, I'm a bit unclear. Is this the solution to the problem above?
In part. I tested the above code at work on a small file and it worked fine.
However, that code appears to be from a method of a class, which will be called by a PHP page.
Edit: Sorry, misread your post. I'm assuming this is the code that was, and still is, in place.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.