Bug 14783 - WAV -> FLAC on OSX fails: SOX error
: WAV -> FLAC on OSX fails: SOX error
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Transcoding
: unspecified
: Macintosh MacOS X 10.5
: P1 normal (vote)
: 7.4.1
Assigned To: Alan Young
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-10-15 04:47 UTC by Michael Herger
Modified: 2009-10-22 11:23 UTC (History)
5 users (show)

See Also:
Category: Bug


Attachments
--debug player.source=debug (52.83 KB, text/plain)
2009-10-16 03:59 UTC, Michael Herger
Details
log of wav playing as flac via sox successfully on Mac OS X 10.6 (11.54 KB, text/plain)
2009-10-19 15:51 UTC, Spies Steven
Details
log of wav playing as flac via sox failing on Mac OS X 10.5 (14.58 KB, text/plain)
2009-10-19 15:51 UTC, Spies Steven
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Herger 2009-10-15 04:47:59 UTC
Trying to play a WAV file on OSX results in silence with the following error message in the logs:

flc
/Users/mh/Documents/workspace/7.4/server/Bin/darwin/sox formats: can't open input  `-': WAVE: RIFF header not found
flc
/Users/mh/Documents/workspace/7.4/server/Bin/darwin/sox formats: can't open input  `-': WAVE: RIFF header not found
Comment 1 Andy Grundman 2009-10-15 08:35:55 UTC
I wonder if you have a bad WAV file.  I can play WAV -> FLAC just fine.
Comment 2 Michael Herger 2009-10-16 03:59:33 UTC
Created attachment 6129 [details]
--debug player.source=debug

Andy - I took a CD, ripped it to WAV using EAC's default settings, tried to play it on the Mac. Failure.

I've tested with all wav files I have, plus that newly ripped file. It always fails.

Did you compile sox on SL? Maybe there's a difference?
Comment 3 James Richardson 2009-10-17 10:38:21 UTC
Andy: did you try it with OSX 10.5 or 10.6?
Comment 4 Andy Grundman 2009-10-17 10:44:26 UTC
10.6, but that shouldn't matter.
Comment 5 Chris Owens 2009-10-19 09:40:42 UTC
Alan, did you have a look at the log?
Comment 6 James Richardson 2009-10-19 09:43:19 UTC
QA to continue to investigate
Comment 7 Spies Steven 2009-10-19 10:29:39 UTC
I am seeing this as well, investigating further.
Comment 8 Spies Steven 2009-10-19 10:57:36 UTC
My log looks pretty much the same as Michael's.  Disabling WAV FLAC and just using WAV WAV does work by the way.

Tested on the following:
Version: 7.4.0 - r28667 @ Mon Sep 28 09:30:43 PDT 2009
Hostname: smsg4pb.local
IP: 172.19.120.81
HTTP Port: 9000
OS: Mac OS X 10.4.11 (8S165) - EN - utf8
Platform: ppc
Perl Version: 5.8.6 - darwin-thread-multi-2level
MySQL Version: 5.0.22-standard
Total Players Recognized: 1
Comment 9 Spies Steven 2009-10-19 12:05:07 UTC
This is also broken on a system running Mac OS X 10.5.7 but is working for me on a system running Mac OS X 10.6.1.  So this looks like a SOX compiling issue.
Comment 10 Andy Grundman 2009-10-19 12:19:00 UTC
sox is unchanged since 7.3, so was this also broken there?
Comment 11 James Richardson 2009-10-19 12:35:46 UTC
7.3.3 works for me.  Looking at File Types for 7.3.3 I see

WAV

FLAC > FLAC
MP3 > disabled
WAV > Native

in 7.4.0/1 I see 

WAV
FLAC > SOX
MP3 > disabled
WAV > PCM
Comment 12 Andy Grundman 2009-10-19 12:42:10 UTC
Ah, OK, here are the changes made to AIFF -> FLAC and WAV -> FLAC in 7.4:

 aif flc * *
-	# FT:{START=--skip=%t}U:{END=--until=%v}
-	[flac] -cs --totally-silent --compression-level-0 $START$ $END$ -- $FILE$
-	
+	# FT:{START=--skip=%t}U:{END=--until=%v}D:{RESAMPLE=-r %d}
+	[flac] -cs --totally-silent --compression-level-0 $START$ $END$ -- $FILE$ | [sox] -q -t flac - -t flac -C 0 $RESAMPLE$ -	
+
 wav flc * *
-	# FT:{START=--skip=%t}U:{END=--until=%v}
-	[flac] -cs --totally-silent --compression-level-0 $START$ $END$ -- $FILE$
+	# IFD:{RESAMPLE=-r %d}
+	[sox] -q -t wav $FILE$ -t flac -C 0 $RESAMPLE$ -

Maybe we need to revert it?  Still doesn't explain why it works for me.
Comment 13 Spies Steven 2009-10-19 15:49:53 UTC
Andy, perhaps you are right about it not being a sox issue.  sox seems to run fine on all my mac systems.  Not sure what else it could be though.  Alan do you have any ideas?  I will attach two more logs to this bug in a moment.
Comment 14 Spies Steven 2009-10-19 15:51:19 UTC
Created attachment 6172 [details]
log of wav playing as flac via sox successfully on Mac OS X 10.6
Comment 15 Spies Steven 2009-10-19 15:51:52 UTC
Created attachment 6173 [details]
log of wav playing as flac via sox failing on Mac OS X 10.5
Comment 16 Alan Young 2009-10-19 22:11:21 UTC
Ah, maybe this is the trigger:

+    # IFD:{RESAMPLE=-r %d}
+    [sox] -q -t wav $FILE$ -t flac -C 0 $RESAMPLE$ -

Perhaps the 'I' in the capabilities line is triggering the problem. Steven, can you try removing it and testing? Perhaps sox on some platforms/os-versions cannot read the WAV (RIFF) header from stdin. That would correspond to the error message in the original description.

This cannot be the real fix because removing 'I' will remove the ability to seek in WAV files.
Comment 17 Michael Herger 2009-10-19 23:58:15 UTC
> Perhaps the 'I' in the capabilities line is triggering the problem.

Confirmed: it's playing fine without the I.
Comment 18 Alan Young 2009-10-20 02:37:46 UTC
So the question is why can sox read the header from stdin fine on 10.6.1 but fails on 10.5.7?
Comment 19 Alan Young 2009-10-20 02:38:41 UTC
Michael, any chance you can try to debug that (I don't have a Mac)?
Comment 20 Michael Herger 2009-10-20 02:48:38 UTC
> Michael, any chance you can try to debug that (I don't have a Mac)?

What do you want me to try?
Comment 21 Alan Young 2009-10-20 02:52:19 UTC
Run sox in a debugger under 10.5 to find out why it fails to read the RIFF header when reading a WAV file from stdin.
Comment 22 SVN Bot 2009-10-20 07:46:17 UTC
 == Auto-comment from SVN commit #28947 to the slim repo by andy ==
 == https://svn.slimdevices.com/slim?view=revision&revision=28947 ==

Fixed bug 14783, when playing a local file we need to always seek to the right point, even if that point is 0.  Audio::Scan may seek into the file on the same filehandle causing the start point to be wrong, for some reason this only appeared to affect OSX 10.5
Comment 23 James Richardson 2009-10-22 11:23:29 UTC
This bug has been marked as fixed in the 7.4.1 release version of SqueezeBox
Server! 

Please see the Release Notes for all the details:
http://wiki.slimdevices.com/index.php/Release_Notes

If you haven't already, please download and install the new version from
http://www.logitechsqueezebox.com/support/download-squeezebox-server.html

If you are still experiencing this problem, feel free to reopen the bug with
your new comments and we'll have another look.