How to decode video which I get from POST method with OpenCV?
I am writing a Python backend for an Android app with Flask. I get video from POST method (when I do this: print(request.files['video'].read())
I get "d3\xb9}\xff\x04\xa4M\xef\x8fS\xc1\xf0\x9e:|ge\x1cfO\xc1\x11ry\x0b\xea\xd1\x82\xf2\xa9-H..."). I can convert it to numpy array by doing this np.frombuffer(request.files['video'].read(), np.uint8)
, but I don't know how I can decode it so that I can then process it with OpenCV. Can you please help me?
read doc imdecode
@LBerger isn't it only for images and not for videos?
since it's a video, not an image, write it to disk, and decode with VideoCapture later
imdecode() would work for a MJPG stream