SoX will randomly fail to read stdin. Here's the command line:
flac --decode --stdout "$f" | sox - -t wav - contrast 0 | lame ....
If I keep trying it, sometimes it works, sometimes not.
When it doesn't work it says: "sox FAIL formats: can't open input `-': WAVE: RIFF header not found". When it works it works perfectly, no problem in the result.
(To make sure it was not flac with the problem I used tee in between to capture a failure and it was identical to success.)
If I add a buffer command in between flac and sox it works every time.
I believe that this bug was in 14.4.0, and fixed in 14.4.1—please can you try a later version?
I'm using version v14.4.1 and it happens there. Is there a newer version I should try?
No, v14.4.1 is the latest. Here, I get the error every time with 14.4.0 but not at all with 14.4.1. Please can you post the output of "sox -V -V --ver" as it contains a few other useful pieces of information.
It doesn't happen every time - maybe 10-30% of the time.
Edit: This was a bug in vorbis-tools (oggdec). See my "On closer examination" post below. Original post for posterity follows:
I observe consistent (100%) failure on Centos7 and the two most recent Ubuntu versions (14.04 LTS and 14.10) when trying to pipe data into sox. both report sox --version v14.4.1
This version of the command consistently fails
but the following succeeds:
http://commons.wikimedia.org/wiki/File:Example.ogg
Last edit: Mark Borgerding 2015-03-18
Here's the extra version info as was earlier suggested.
It fails consistently under all these platforms
Under CentOS Linux release 7.0.1406 :
Under Ubuntu 14.04.2 LTS :
Under Ubuntu 14.10:
Last edit: Mark Borgerding 2015-03-18
OK, on closer examination, it looks like this is a problem with vorbis-tools. Under some conditions, oggdec writes its version number to stdout.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=595104
i.e. the redirection (">") is acting differently than the stdio pipe ("|")
I'm closing this.