Search code examples
google-chromehtml5-videohandbrakehandbrake-js

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


I'm trying to convert a video using handbrake-js for node. At first I tried specifying the bitrate, video size, codecs, etc. The goal is to generate several html5 compatible streams to be used as a source on a canvas video for webGL. Everything seems to work fine, it outputs the video, and when I open it using Quicktime or VLC it looks fine, however, when I use it on a tag, there is no video, just audio.

The following code is called whithin a function which receives an "ops" JSON, with the width and height.

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 })

The console shows the video being converted, and a clean exit. but webGL reports:

[.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.

Note: The video IS a power of 2 (1024x512). Also when I play the original file it doesen't show the error.

To debug, I have even attached the video to the HTML, and changed the CSS to show it. but there is no video. just audio.

I have even tried:

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

and a simple Well... input.mp4 displays fine. output.m4v always fails to show video on HTML (Chrome, safari seems to work just fine).

Any ideas?


Solution

  • If you say preset: Normal works, then you can run handbrake --preset-list (using handbrake-js installed as a command-line app) to see which encoder options the "normal" preset uses:

    + 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
    

    So, try running hb.spawn using the options above and remove any options you don't need.