ffmpeg 以代码 1 退出:重新初始化过滤器时出错!无法将帧注入过滤器网络:参数无效
ffmpeg exited with code 1: Error reinitializing filters! Failed to inject frame into filter network: Invalid argument
我正在使用 video show npm 从多个图像创建一个视频。最初有一个问题,但后来我下载并安装了 ffmpeg。
现在又出现了一个错误。在此先感谢大家。
这是我的代码:
//create a video from multiple images
var secondsToShowEachImage = 3
var finalVideoPath = '/outputImages/newvideo2.mp4'
// setup videoshow options
var videoOptions = {
fps: 24,
transition: false,
videoBitrate: 1024 ,
videoCodec: 'libx264',
size: '640x640',
outputOptions: ['-pix_fmt yuv420p'],
format: 'mp4'
}
let path1= '/InputImages/abc.jpg';
let path2 = '/InputImages/xy.jpg'
let path3 = '/InputImages/ab.jpg'
// array of images to make the 'videoshow' from
var images = [
{path: path1, loop: secondsToShowEachImage},
{path: path2, loop: secondsToShowEachImage}
]
console.log('working --->')
videoshow(images, videoOptions)
.save(finalVideoPath)
// console.log('hello world')
.on('start', function (command) {
console.log('encoding ' + finalVideoPath + ' with command ' + command)
})
.on('error', function (err) {
console.log('err' , err)
// return Promise.reject(new Error(err))
})
.on('end', function (output) {
// do stuff here when done
})
错误是
err Error: ffmpeg exited with code 1: Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #1:0
Conversion failed!
at ChildProcess.<anonymous> (E:\Video-Editor-Practice\Nodees6video-editor\NewVideoEditor\node_modules\fluent-ffmpeg\lib\processor.js:182:22)
This issue is due to images sizes. Resize all images first then try again
use this below code
use this code for all images of video.
const image = await Jimp.read(path);
image.resize(ResizeImageWidth , ResizeImageHeight )
.write(outputImagepath);
我正在使用 video show npm 从多个图像创建一个视频。最初有一个问题,但后来我下载并安装了 ffmpeg。
现在又出现了一个错误。在此先感谢大家。
这是我的代码:
//create a video from multiple images
var secondsToShowEachImage = 3
var finalVideoPath = '/outputImages/newvideo2.mp4'
// setup videoshow options
var videoOptions = {
fps: 24,
transition: false,
videoBitrate: 1024 ,
videoCodec: 'libx264',
size: '640x640',
outputOptions: ['-pix_fmt yuv420p'],
format: 'mp4'
}
let path1= '/InputImages/abc.jpg';
let path2 = '/InputImages/xy.jpg'
let path3 = '/InputImages/ab.jpg'
// array of images to make the 'videoshow' from
var images = [
{path: path1, loop: secondsToShowEachImage},
{path: path2, loop: secondsToShowEachImage}
]
console.log('working --->')
videoshow(images, videoOptions)
.save(finalVideoPath)
// console.log('hello world')
.on('start', function (command) {
console.log('encoding ' + finalVideoPath + ' with command ' + command)
})
.on('error', function (err) {
console.log('err' , err)
// return Promise.reject(new Error(err))
})
.on('end', function (output) {
// do stuff here when done
})
错误是
err Error: ffmpeg exited with code 1: Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #1:0
Conversion failed!
at ChildProcess.<anonymous> (E:\Video-Editor-Practice\Nodees6video-editor\NewVideoEditor\node_modules\fluent-ffmpeg\lib\processor.js:182:22)
This issue is due to images sizes. Resize all images first then try again
use this below code
use this code for all images of video.
const image = await Jimp.read(path);
image.resize(ResizeImageWidth , ResizeImageHeight )
.write(outputImagepath);