handbrake-js(节点)html5-Chrome 上没有视频

handbrake-js (node) no video on html5-Chrome

我正在尝试使用 handbrake-js 为节点转换视频。 起初我尝试指定比特率、视频大小、编解码器等。目标是生成几个 html5 兼容的流,用作 webGL canvas 视频的源。一切似乎都很好,它输出视频,当我使用 Quicktime 或 VLC 打开它时它看起来很好,但是,当我在标签上使用它时,没有视频,只有音频。

以下代码在函数中调用,该函数接收 "ops" JSON,宽度和高度。

hb.spawn({ input: new_location + "original" + ext, output: new_location + ops.name, optimize: true, vb: ops.vb, "width": ops.width, "height": ops.height, "rate": 30 })

控制台显示正在转换的视频,并干净退出。 但 webGL 报告:

[.Offscreen-For-WebGL-0x7fbf21074c00]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.

注意:视频 2 的幂 (1024x512)。另外,当我播放原始文件时,它没有显示错误。

为了调试,我什至将视频附加到 HTML,并更改了 CSS 以显示它。但是没有视频。只是音频。

我什至尝试过:

hb.spawn({ input: "input.mp4", output: "output.m4v" })

还有一个简单的 嗯... input.mp4 显示正常。 output.m4v 总是无法在 HTML 上显示视频(Chrome,safari 似乎工作正常)。

有什么想法吗?

如果你说 preset: Normal 有效,那么你可以 运行 handbrake --preset-list(使用 handbrake-js installed as a command-line app)查看 "normal" 的编码器选项预设用途:

+ Normal:  -e x264  -q 20.0 -a 1 -E ffaac -B 160 -6 dpl2 -R Auto -D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 --loose-anamorphic --modulus 2 -m --x264-preset veryfast --h264-profile main --h264-level 4.0

因此,尝试 运行ning hb.spawn 使用上述选项并删除您不需要的任何选项。