If you do it naively your video frames will buffer waiting to be consumed causing a memory leak and eventual crash (or quick crash if you’re running on a device with constrained resources).
You really need to have a thread consuming the frames and feeding them to a worker that can run on its own clock.