Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mixing audio using SOX , sox FAIL formats: can't open input file `audio_recorded.wav': WAVE: RIFF header not found

I want to mix audio using SOX in linux. This is my script. I'm a total beginner on this thing.

    time sox --buffer 128000 --combine mix audio1.mp3 audio_recorded.wav -C 64.0 "./Mixed.mp3"
    time ffmpeg -loglevel warning -i ./Output.wav -c:a libfdk_aac -b:a 64k -map 0:0 -f segment -segment_time 10 -segment_list ./Output.m3u8 -segment_format aac './stream%03d.aac'

    cd ..

but the result is like this..

    sox FAIL formats: can't open input file `audio_recorded.wav': WAVE: RIFF header not found

    real    0m0.003s
    user    0m0.000s
    sys     0m0.002s

The audio_recorded.wav is a recorded audio file from android.

[REMOVED ANDROID CODE: no longer necessary]

UPDATE: I have tried to revise my recorder..set bit rate and sample rate same to audio1.mp3. Then I tried to mix it. This is now what happens:

    [root@app complete]# bash test_mix.sh 
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: recoverable MAD error
    sox WARN mp3-util: recoverable MAD error
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: recoverable MAD error
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: recoverable MAD error
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: recoverable MAD error
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: recoverable MAD error
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: recoverable MAD error
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: recoverable MAD error
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: recoverable MAD error
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: recoverable MAD error
    sox WARN mp3-util: recoverable MAD error
    sox WARN mp3-util: recoverable MAD error
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: recoverable MAD error
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: recoverable MAD error
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox WARN mp3-util: MAD lost sync
    sox FAIL formats: can't open input file `sound997309159.mp3': 

    real    0m0.005s
    user    0m0.002s
    sys     0m0.002s

I set the sample rate and bit rate of the recorded since when i tried mixing it in sox, it prompted me that the files dont have same channel and bit rate.

like image 638
elL Avatar asked Jun 14 '13 05:06

elL


1 Answers

probably the file has no header. You can specify the file type with

-t <file-type>

this is the man page: http://sox.sourceforge.net/sox.html

like image 154
gino pilotino Avatar answered Sep 22 '22 16:09

gino pilotino