Menu

#247 SoX randomly fails to read stdin

closed-invalid
nobody
5
2018-04-26
2014-06-02
No

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.

Discussion

  • robs

    robs - 2014-10-30

    I believe that this bug was in 14.4.0, and fixed in 14.4.1—please can you try a later version?

     
  • robs

    robs - 2014-10-30
    • status: open --> pending-fixed
     
  • Ariel Shkedi

    Ariel Shkedi - 2014-10-30

    I'm using version v14.4.1 and it happens there. Is there a newer version I should try?

     
  • robs

    robs - 2014-10-30

    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.

     
  • Ariel Shkedi

    Ariel Shkedi - 2014-10-30

    sox -V -V --ver
    sox: SoX v14.4.1
    time: Apr 16 2013 03:39:20
    issue: Debian
    uname: Linux localhost 3.2.60 #2 SMP Wed Jul 23 19:26:55 EDT 2014 x86_64
    compiler: gcc 4.7.2
    arch: 1248 48 44 L OMP

    It doesn't happen every time - maybe 10-30% of the time.

     
  • Mark Borgerding

    Mark Borgerding - 2015-03-13

    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

    oggdec -o - /tmp/Example.ogg | sox -t wav -  -t au - > output.au
    
    FAIL formats: can't open input  `-': WAVE: RIFF header not found
    

    but the following succeeds:

    oggdec -o - /tmp/Example.ogg > DATA
    cat DATA | sox -t wav -  -t au - > output.au
    

    http://commons.wikimedia.org/wiki/File:Example.ogg

     

    Last edit: Mark Borgerding 2015-03-18
  • Mark Borgerding

    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 :

    $ sox -V -V --ver
    sox:      SoX v14.4.1
    time:     Jun 10 2014 00:25:39
    issue:    Fedora
    uname:    Linux schur 3.10.0-123.20.1.el7.x86_64 #1 SMP Thu Jan 29 18:05:33 UTC 2015  x86_64
    compiler: gcc 4.8.2 20140120 (Red Hat 4.8.2-16)
    arch:     1288 48 88 L OMP
    

    Under Ubuntu 14.04.2 LTS :

    $ sox -V -V --ver
    sox:      SoX v14.4.1
    time:     Dec 31 2013 01:47:13
    issue:    Ubuntu
    uname:    Linux descartes 3.13.0-45-generic #74-Ubuntu SMP Tue Jan 13 19:36:28 UTC 2015 x86_64
    compiler: gcc 4.8.2
    arch:     1288 48 88 L OMP
    

    Under Ubuntu 14.10:

    $ sox -V -V --ver
    sox:      SoX v14.4.1
    time:     May 23 2014 02:18:33
    issue:    Ubuntu
    uname:    Linux galois 3.16.0-31-generic #41-Ubuntu SMP Tue Feb 10 15:24:04 UTC 2015 x86_64
    compiler: gcc 4.8.3
    arch:     1288 48 88 L OMP
    
     

    Last edit: Mark Borgerding 2015-03-18
  • Mark Borgerding

    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

    [markb@schur]$ oggdec -o - /tmp/Example.ogg > /tmp/f1
    [markb@schur]$ head -c4 /tmp/f1
    RIFF
    
    [markb@schur]$ oggdec -o - /tmp/Example.ogg |cat > /tmp/f2
    [markb@schur]$ head -c4 /tmp/f2
    oggd
    

    i.e. the redirection (">") is acting differently than the stdio pipe ("|")

     
  • Mans Rullgard

    Mans Rullgard - 2018-04-26
    • status: pending-fixed --> closed-invalid
     
  • Mans Rullgard

    Mans Rullgard - 2018-04-26

    I'm closing this.

     

Log in to post a comment.