Search code examples
audioffmpegsoxaudacityfile-recovery

Trim off N bytes from audio file using SoX / FFmpeg etc, on Windows?


My team accidentally on purpose clicked NO when Audacity asked to save the recording. So I left with bunch of *.au files, after using recovery program.

Some of them did have header and still open-able with audacity itself (example : this one), and some other are just complete nonsense, sometimes having the header filled with text from random javascript or HTML code (like this one). Probably hard disk half overwritten with browser cache? I don't know. And at this point, I almost don't care.

The audacity is on default settings, with sample rate 44100Hz. I can open a-113.au using audacity, from standard open files. I also was able to achieve open files using "Open RAW files" from Audacity, using this settings :

enter image description here

so I assume header takes 12384 bytes.

Now, how do I trim 12384 bytes from the file when opened as RAW, with either SoX or ffmpeg? because if I open it as RAW with 0 offset (default settings), it will add the header as a noise.

Current ffmpeg command I used : ffmpeg.exe -f f32le -ar 44.1k -ac 1 -i source destination
Current sox command I used : sox -t raw --endian little --rate 44100 -b 1 -b 32 --encoding floating-point %%A "converted/%%~nxA.wav"
Both still have header as a noise in the converted files.


Solution

  • With ffmpeg, use the subfile protocol.

    ffmpeg.exe  -f f32le -ar 44.1k -ac 1 -start 12384 -i  "subfile:source" destination