ArtskydJ / node-sox-stream

:mega: A stream-friendly wrapper around SoX
53 stars 14 forks source link

VBR on MP3 files #10

Closed CliffS closed 5 years ago

CliffS commented 6 years ago

If I set the following parameters, SoX should use the best VBR and a low quality (I'm dealing with voice recordings).

output: {
  type: 'mp3',
  compression: -9.8
}

However, I get the following errors:

Error: unable to write VBR tag because we can't seek
Error: ENOENT: no such file or directory, unlink '/tmp/db9a3eba-3f09-45d0-886e-3f29ed214394'
Error: ENOENT: no such file or directory, unlink '/tmp/db9a3eba-3f09-45d0-886e-3f29ed214394'

So it looks like the temp file may be being unlinked at the wrong stage.

Is this a known issue? Is there any work-around?

Thanks.

ArtskydJ commented 6 years ago

My guess is that the first issue Error: unable to write VBR tag because we can't seek is causing the second and third issue.

I think SoX can't seek the output stream, which is causing the error. If it was using a file, it would be able to seek that file. It looks like you need to use SoX with files if you use VBR. To test if this is the case, you could run this script

cat input.mp3 | sox - --type=mp3 --compression=-9.8 - > output.mp3

or something similar. I'm not sure which flag enables VBR output... Anyway, I would expect the same error even when running from the command line.

You could use sox.js with an input file and an output file. That way SoX is able to do all of its fancy stuff with the file, and isn't limited to the streaming mode. I've had quite a few issues with the streaming mode, but for dead-simple transcodes it works alright.

ArtskydJ commented 5 years ago

I'm gonna close this since it has been inactive for over a year.