Tensorflow.js error: must be either an HTMLVideoElement but was HTMLVideoElement
I finally managed to get it to work by opening a issue in the tfjs repo
I copy here the solution provided by the github user tafsiri

After digging around a bit, it looks like your project is running in
separate context mode and there are two JS contexts in which code is
run. Your code is being run in the browser context and the tfjs
library code is being run in the node context. In the node context
video instanceof HTMLVideoElement returns false. The nw.js docs
suggest that browser api's aren't usable in the node context so there
may be incompatibility there.
Their docs suggest you can switch to mixed context mode, I tried that
by adding the following entry to the package.json and then it worked.
&quot;chromium-args&quot;: &quot;--mixed-context&quot;, If you want to stay in separate
context mode (and I don't know enough about nw.js to know the
advantages and disadvantages of each) you would need to not use any of
the browser specific apis of tfjs.