I have a flask app. When i run it on my pc it can take videofile, create non-black thumbnail, using flowing code:
uploaded_files = request.files.getlist("file[]")
for i in uploaded_files:
......
vcap = cv2.VideoCapture(file_path)
b = io.BytesIO()
res, im_ar = vcap.read()
while im_ar.mean() < 2 and res:
res, im_ar = vcap.read()
r=cv2.resize(im_ar, size, interpolation = cv2.INTER_CUBIC)
b=cv2.imencode('.jpeg', r)[1]
s3.Bucket('MY_BUCKET').put_object(Key=MY_KEY, Body=b.tobytes(), ACL= 'public-
read',ContentType='image/jpeg', ContentDisposition= 'inline')
For some reason cv2.VideoCapture() doesn't accept any form of "i" as argument: "i.read()/i.file/etc". btw, maybe u can help with that? So I have to use "file_path" which can be a link or a path to local file, both works when it's running on my pc.
type(vcap) = class 'cv2.VideoCapture' type(im_ar) = class 'numpy.ndarray'
But when i run exactly the same code on remote ubuntu server, use the same files, i get this: File "/home/ubuntu/scanner/app/routes.py", line 478, in b while im_ar.mean() < 2 and res: AttributeError: 'NoneType' object has no attribute 'mean'
OpenCV 3.4.3 FFMPEG: YES
How can i fix it?