I have an Electron app with ffmpeg.exe
inside the project's bin
folder. When i try to use ffmpeg to make a new video I get an error reading the input file.
FFmpeg error: [in#0 @ 000002667f2ab9c0] Error opening input: No such file or directory
Error opening input file C:/Users/xxxx/Videos/Powder/2023.08.19%2017.30.37_Apex_Legends/Powder_2023.08.19%2021.00.48.mp4
const ffmpeg = spawn(ffmpegPath, [
'-i', videoFile,
'-filter_complex', filterComplex,
'-map', '[out]',
'-c:v', 'libx264',
'-crf', '18',
'-preset', 'veryfast',
'-y',
path.join(outputDir, outputName)
]);
ffmpeg.stdout.on('data', (data) => {
console.log(`FFmpeg output: ${data}`);
});
ffmpeg.stderr.on('data', (data) => {
console.error(`FFmpeg error: ${data}`);
});
ffmpeg.on('close', (code) => {
console.log(`FFmpeg process exited with code ${code}`);
event.reply('ffmpeg-export-done'); // Notify the renderer process
});
How can i resolve this path issue?
I had to decode the file path as it was in URI format.
const decodeURI = (uri) => {
return uri.replace(/%[0-9A-F]{2}/g, match => String.fromCharCode('0x' + match.slice(1)));
};