OpenCV Heroku - video encode/decode
I'm wondering if it is possible to encode/decode videos in production on Heroku using opencv-python (along with the Django framework, or with the Flask framework if it needs to be that instead). Basically, the goal is to be able to run functions like the following
import cv2
video = cv2.VideoCapture('url/to/video')
Then from there, be able to run something like: fps = video.get(cv2.CAP_PROP_FPS)
Currently when I right the fps
assignment line, I get back 0
for anything. If you were to run video.read()
you would get back false. There seems to be no way to actually read video files in production. Is this an Opencv-python bug? Or is this something that is not possible?
I've asked this question in a number of places and people seem to think that the only line I'm trying to run is import cv2
and claim that what I'm trying to do is "totally possible". I'm not having trouble importing the library. It's getting any video functions to work. These functions all work locally. But they do not work on a Heroku app in production. Is this something that is not possible with this library?
Tools Im using locally: Python 3.6.4, Django 2.0, Anaconda 4.5.4, Opencv-python 3.4.1
step1: try a
print(cv2.getBuildInformation())
and see, if it has any video capabilities (Video IO section)also, how exactly did you install cv2 there ?
When I ran that command, Video I/O section reported
NO
, but the FFMPEG reportedYES
Installing opencv on my heroku app was just a matter of deploying the app. I haven't done anything special just yet. Trying to see if this is possible. I did try attaching custom buildpacks though. Didn't work out.
same here (installed via PIP / requirements.txt)
so it might be possible !
Is it working for you?
do you have an url ? (can't find anything useful, weird)