简体   繁体   中英

raw h264 to GIF node js

I am trying to use the "pi-camera" library which is working and allowing me to record video in a raw h264 format on my r-pi. However, the node js library "gifify" continuously gives me the error "RangeError: Maximum call stack size exceeded" looking this error up it seems to be related calling many functions within functions multiple times or something related to this. However, my code only uses one function which contains a simple command to take the video and then convert it.

 const PiCamera = require('pi-camera'); var fs = require('fs'); var gifify = require('gifify'); var path = require('path'); var sleep = require('system-sleep'); const myCamera = new PiCamera({ mode: 'video', output: `/home/pi/Videos/video.h264`, width: 640, height: 480, time: 5000, nopreview: true, vflip: true, }); var input = path.join('/home/pi/Videos', 'video.h264'); var output = path.join('/home/pi/Videos', 'daily.gif'); var gif = fs.createWriteStream(output); var options = { speed: 5, text: 'Daily Plant GIF' }; sleep(5000); setInterval(vid, 10000); function vid(){ myCamera.record() .then((result) => { console.log('success'); gifify(input, options).pipe(gif); }) .catch((error) => { console.log(error); }); } 

any information on what this error truly means in this scenario/ how to fix it would be much appreciated. Thank you!

an error can be related not to your code only but also to libraries you are using.

I see at least few issues been reported to gifyfy about "maximum stack exceeded" open one: https://github.com/vvo/gifify/issues/94

I'm not sure if there is any workaround in your case. maybe you need trying different parameters or look for different library

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM