Closed umaar closed 1 year ago
Getting exact same error, did you manage to work this out?
Figured it out, I'm using windows and the output directory needs to exist for generating frames. I updated this function:
export async function extractFramesFromVideo(inputFilepath, outputFilepath, frameRate) {
await new Promise((resolve, reject) => {
// Ensure output path exists
const filePath = dirname(outputFilepath);
if (!existsSync(filePath)) {
console.log('Path does not exist');
mkdirSync(filePath);
}
ffmpeg()
// Specify the filepath to the video
.input(inputFilepath)
// Instruct FFmpeg to extract frames at this rate regardless of the video's frame rate
.fps(frameRate)
// Save frames to this directory
.saveToFile(outputFilepath)
.on('end', () => resolve())
.on('error', (error) => reject(new Error(error)));
});
}
Thanks, that works!
Thanks for this! Getting some errors, any ideas?