最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - ffmpeg exited with code 1: Error reinitializing filters! Failed to inject frame into filter network: Invalid argume

programmeradmin1浏览0评论

Using video show npm I am creating a video from multiple images. initially there was an issue but then I download and installed ffmpeg.

Now another error occurs. Thanks to everyone in advance.

This is my code:

//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 (mand) { 

  console.log('encoding ' + finalVideoPath + ' with mand ' + mand) 
})
.on('error', function (err) {
   console.log('err' , err)
//   return Promise.reject(new Error(err)) 
})
.on('end', function (output) {
  // do stuff here when done
})

The error is

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)

Using video show npm I am creating a video from multiple images. initially there was an issue but then I download and installed ffmpeg.

Now another error occurs. Thanks to everyone in advance.

This is my code:

//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 (mand) { 

  console.log('encoding ' + finalVideoPath + ' with mand ' + mand) 
})
.on('error', function (err) {
   console.log('err' , err)
//   return Promise.reject(new Error(err)) 
})
.on('end', function (output) {
  // do stuff here when done
})

The error is

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)
Share Improve this question edited Apr 17, 2022 at 20:07 marc_s 757k184 gold badges1.4k silver badges1.5k bronze badges asked Oct 28, 2021 at 13:54 Ejaz khanEjaz khan 2,1251 gold badge10 silver badges18 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

This issue is due to images sizes. Resize all images first then try again use this code for all images of video.

const image = await Jimp.read(path);  
image.resize(ResizeImageWidth , ResizeImageHeight )
.write(outputImagepath);

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论