webm-duration-fix
webm-duration-fix copied to clipboard
RangeError: The value of "byteLength" is out of range.
Hi i'm using this module in electron and everything works fine after until i've built the app with electron-builder Then I get this error:
RangeError: The value of "byteLength" is out of range. It must be >= 1 and at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)
at new NodeError (node:internal/errors:371:5)
at boundsError (node:internal/buffer:86:9)
at Buffer.readUIntBE (node:internal/buffer:273:3)
at w.readContent (main.c1a754a1e0df31f1.js:1:307044)
at w.readChunk (main.c1a754a1e0df31f1.js:1:305350)
at w.decode (main.c1a754a1e0df31f1.js:1:305037)
at main.c1a754a1e0df31f1.js:1:375265
at F (main.c1a754a1e0df31f1.js:1:374710)
at Object.next (main.c1a754a1e0df31f1.js:1:374817)
at I (main.c1a754a1e0df31f1.js:1:373505)
at v.invoke (polyfills.ffcb200af55b2a7d.js:1:6543)
at Object.onInvoke (main.c1a754a1e0df31f1.js:1:1495746)
at v.invoke (polyfills.ffcb200af55b2a7d.js:1:6483)
at M.run (polyfills.ffcb200af55b2a7d.js:1:1939)
at polyfills.ffcb200af55b2a7d.js:1:16777
at v.invokeTask (polyfills.ffcb200af55b2a7d.js:1:7161)
at Object.onInvokeTask (main.c1a754a1e0df31f1.js:1:1495559)
at v.invokeTask (polyfills.ffcb200af55b2a7d.js:1:7082)
at M.runTask (polyfills.ffcb200af55b2a7d.js:1:2556)
at _ (polyfills.ffcb200af55b2a7d.js:1:9176)
Anyone know whats going on here?
我也碰到这个问题了,我是把录像直接保存到文件了,然后录制完成后再通过这个工具进行修复,但报错了。
const fixDuration = async (filePath: string): Promise<Blob> => {
return new Promise((resolve, reject) => {
// 读取视频文件内容
const buf = fs.readFileSync(filePath);//读取文件,并将缓存区进行转换
const uint8Buffer = Uint8Array.from(buf);
const blob = new Blob([uint8Buffer],{type:'video/mp4'});
console.log("转换后", blob)
fixWebmDuration(blob).then((blob) => {
log.log('修复webm文件时长成功')
//将Blob文件流写入文件
saveBlob(blob).then(res => {
let stream = fs.createWriteStream(filePath, {mode: 777, flags: 'w', autoClose: true});
stream.write(res);
stream.end();
})
resolve(blob)
}).catch((e) => {
log.error('修复webm文件时长失败:%s', e)
reject(e)
})
})
}
Same for me, excepting that I'm getting this both in development and in release build. Electron 22.3.3.