Open Ennnm opened 2 years ago
You get that error because the 2>
is a shell thing, not a program thing.
Use -report
instead.
I finally figured out the solution. We can use a custom logger. Maybe we should add this to the doc.
const output: string[] = [];
const ffmpeg = createFFmpeg();
ffmpeg.setLogger(({ message }) => {
output.push(message);
});
await ffmpeg.load();
Here's what worked for me (based on @brunoais's suggestion; thank you)
await ffmpeg.exec([
"-i",
"/home/source/TEST.mp3",
"-report", // <-- this is key
"-af",
"silencedetect=d=0.8",
"-f",
"null",
"-",
]);
// grab latest execution report
const entries = await ffmpeg.listDir("/");
const logFiles = entries.filter((e) => !e.isDir).filter((e) => e.name.match(/ffmpeg-[0-9-]+\.log/gi));
if (logFiles.length === 0) {
// no logs 🤷♂️
}
return (await ffmpeg.readFile(`/${logFiles.sort()[logFiles.length - 1].name}`, "utf8")) as string;
Describe the bug Hello! I was trying to save the silences produced by the filter in a .txt file for reference
To Reproduce Steps to reproduce the behavior: 1.
await ffmpeg.run( '-i', 'test.aac', '-af', 'silencedetect=d=0.8', '-f', 'null', '-', '2>', 'silences.txt' );
the command works when its just
await ffmpeg.run( '-i', 'test.aac', '-af', 'silencedetect=d=0.8', '-f', 'null', '-' );
Expected behavior Expected that a .txt file with the logs for silences to be produced in memfs. It worked with vanilla ffmpeg Not sure how to write this command.
Have seen other discussions where the desired log in parsed from the the logger, is this the only way? https://github.com/ffmpegwasm/ffmpeg.wasm/issues/277