gpt4 book ai didi

node.js - 使用 Nodejs + ffmpeg 或 handbrake 编码视频

转载 作者:搜寻专家 更新时间:2023-10-31 23:13:21 26 4
gpt4 key购买 nike

我一直在寻找一种从 NodeJS 同时编码多个视频的方法,但我还没有找到一个好的解决方案。

使用 FFMPEG 我从来没有得到 100% 无故障响应。总是有一个 splinter 的视频。

操作系统:Ubuntu 12.04

size = "#{options.maxWidth}x#{options.maxHeight}"
proc = new ffmpeg({
source: options.input
}).withVideoCodec(options.encoder).withSize(size).keepPixelAspect(true).withStrictExperimental()
proc.onProgress (progress) ->
console.log "progress: " + progress.percent

proc.saveToFile options.output, (stdout, stderr) ->
console.log "file has been converted succesfully"

最佳答案

你有没有考虑过handbrake-js

编码示例:

const hbjs = require('handbrake-js')

hbjs.spawn({ input: 'video.avi', output: 'video.m4v' })
.on('progress', progress => {
const { percentComplete, eta } = progress
console.log(`Percent complete: ${percentComplete}, ETA: ${eta}`
})

关于node.js - 使用 Nodejs + ffmpeg 或 handbrake 编码视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22620175/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com