I'm attempting to convert a .webm
audio file to a .wav
audio file using fluent-ffmpeg. I've looked through all kinds of example code, but whenever I run my code I get no output or errors whatsoever:
import ffmpeg from 'fluent-ffmpeg';
function verifyAudio({ testFile }) {
// parse file name for wav file from testFile
const wavFile = testFile.split('.')[0] + '.wav';
console.log(`wavFile: ${wavFile}`);
// convert to wav file
ffmpeg(testFile)
.inputFormat('webm')
.outputFormat('wav')
.on('start', function(commandLine) {
console.log('Spawned Ffmpeg with command: ' + commandLine);
})
.on('progress', (progress) => {
console.log('Processing: ' + progress.targetSize + ' KB converted');
})
.on('end', function(err) {
console.log('done!', err);
})
.on('error', function(err) {
console.log('an error: ' + err);
}).saveToFile(wavFile);
console.log('finished conversion');
}
export { verifyAudio };
This function takes in the name of the input .webm
file as an argument, and attempts to convert it to a .wav
file with filename wavFile
. When this runs, I see the output of console.log(
wavFile: ${wavFile});
, I see the output of console.log('finished conversion');
, but none of the .on
outputs in the ffmpeg
call. No errors are raised at all. Not even when I insert a non-existent filename as testFile
. And no output file is generated (not even an empty one).
I have no idea what's going on here, since I have no output to debug on! What is happening here?
I've tried many combinations of defining inputs and outputs, including the various formats. I've tried doing the conversion on the command line using ffmpeg
, it it works fine.
I'm expecting to see the output file: A .wav
file with the filename wavFile
. I see nothing.