bun
bun copied to clipboard
fluent-ffmpeg fails silently
What version of Bun is running?
0.7.3
What platform is your computer?
Darwin 21.6.0 arm64 arm
What steps can reproduce the bug?
import ffmpeg from "fluent-ffmpeg";
import fs from "fs";
/**
* Uses ffmpeg to convert a file to mp3
*
* Returns the new file path on success
*/
export const convertToMp3 = (
sourcePath: string,
destinationPath: string,
config?: {
toWav?: boolean;
}
): Promise<string | undefined> => {
const toWav = config?.toWav;
console.log("HI THERE");
return new Promise<string | undefined>((resolve) => {
if (!fs.existsSync(sourcePath)) {
console.log("sourcePath doesn't exist", sourcePath);
}
console.log("START NOW");
ffmpeg({ source: sourcePath })
.toFormat(toWav ? "wav" : "mp3")
.save(destinationPath)
.on("end", () => {
console.log("END");
resolve(destinationPath);
})
.on("codecData", (e) => console.log(e))
.on("progress", (e) => console.log(e))
.on("error", (e: Error) => {
console.log({ e });
resolve(undefined);
});
});
};
import path from "path";
import { convertToMp3 } from "./convertToMp3.js";
const test = async () => {
console.log("start");
const p1 = path.join(
"/Users/king/os/packages/parsing-files/ffmpeg-util/assets/test.ogg"
);
const p2 = path.join(
"/Users/king/os/packages/parsing-files/ffmpeg-util/assets/test.mp3"
);
console.log({ p1, p2 });
await convertToMp3(p1, p2, { toWav: false }).then(console.log);
};
test();
TEST FILE: any ogg file
What is the expected behavior?
It works fine on node
What do you see instead?
It fails silently. No errors, nothing.
Additional information
I did a clean install of ffmpeg
right before the test with brew
and have the newest version of fluent-ffmpeg
:
"dependencies": { "fluent-ffmpeg": "^2.1.2" },