python - Weird OpenCV .read() hangs with no error -


i have website allows users upload videos. during process there script automatically creates thumbnail. here code using accomplish this:

f = request.files['video'] f_temp = open('/path/to/video/dir/' + f.name, 'wb+') chunk in f.chunks():     f_temp.write(chunk)     f_temp.close() cap = cv2.videocapture('/path/to/video/dir/' + f.name) nothing, img = cap.read() cv2.imwrite('/path/to/thumbnail/dir/' + f.name.split('.')[0] + '.png', img) 

currently, video saved properly. however, when creating thumbnail, script hangs @ cap.read() , never throws error.

now here's weird part - if remeve last 3 lines upload video , doesn't create thumbnail, can ssh server , run last 3 lines directly , works should. script hangs when running live on website ...

i have no clue why happen when code called through web request.

i tried switching cap.read() cap.grab() img = cap.retrieve(), hangs on .retrieve() instead.

solved downgrading opencv 3.0.0 opencv 2.4.0. above 2.4.0 has issue when running python 2.7


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -