node.js – ffmpeg file doesn’t exist, but file exists and path is correct
I’m getting a “No such file or directory” error even though the files exists and the path is correct
Image for reference
Here is the code I have
// initialize imports
const ffmpeg = require('fluent-ffmpeg')
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path
const ffprobePath = require('@ffprobe-installer/ffprobe').path
// initialize paths for ffmpeg
ffmpeg.setFfmpegPath(ffmpegPath)
ffmpeg.setFfprobePath(ffprobePath)
// export merge function
module.exports.merge = async () => {
await ffmpeg('./viral.mp4')
.input('./rand_gta.mp4')
.complexFilter([
`[0:v]scale=576:1024[0scaled]`,
`[1:v]scale=576:512[1scaled]`,
`[0scaled]pad=576:1024[0padded]`,
`[0padded][1scaled]overlay=0:550[output]`,
])
.outputOptions(['-map 0:a', '-map [output]'])
.output('./out.mp4')
.on('error', function (er) {
console.log('error occured: ' + er.message)
})
.on('progress', ({ percent }) => {
const value = percent.toFixed(2)
console.log(`Processing video: ${value}%`)
})
.run()
}
Any feedback, help. is very much appreciated
Read more here: Source link