How to get mats from youtube video in real time

I want to apply background subtraction on a live youtube video in android. This means I press play on a youtube video and produce a grayscale background subtraction mat in real time.

I’m currently using react native and found react-native-opencv3. It works fine when manipulating the android camera but I also want to manipulate youtube videos as well. I can currently do background subtraction using the front and back cameras, but not background subtraction on a youtube video.

Problems:

  • get a live frame from a youtube video and use it as a mat
  • manipulate mat
  • display the modified mat in oncameraframe

Any hints, tricks, resources so you can point me in the right direction? Much help would be appreciated. Thank you!

don’t expect anyone here to know about it
(no support from opencv for 3rdparty wrappers like that)

tl:dr; - opencv on android won’t be able to do that for you.