Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why does OpenCV VideoCapture using a URL not work on Heroku?

I'm trying to open a videoURL using cv2.VideoCapture on Heroku, and it consistently fails to open. I've called the same code on my local machine (Windows 10) and it ran with no problems. Does anyone have recommendations/buildpacks/alternatives to resolve this?

OpenCV Version: 3.4.2.16

Python: 3.7

Current Buildpacks:

  • https://github.com/cstavish/heroku-buildpack-vips.git

  • https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git

  • https://github.com/heroku/heroku-buildpack-apt

  • heroku/python

  • https://github.com/timanovsky/subdir-heroku-buildpack

Open Cv Build info (Video) from the Heroku Dyno

Video I/O:
DC1394:                      NO
FFMPEG:                      YES
avcodec:                   YES (ver 58.21.104)
avformat:                  YES (ver 58.17.101)
avutil:                    YES (ver 56.18.102)
swscale:                   YES (ver 5.2.100)
avresample:                NO
GStreamer:                   NO
libv4l/libv4l2:              NO
v4l/v4l2:                    linux/videodev.h linux/videodev2.h
gPhoto2:                     NO

Why does OpenCV VideoCapture using a URL not work on Heroku?

I'm trying to open a videoURL using cv2.VideoCapture on Heroku, and it consistently fails to open. I've called the same code on my local machine (Windows 10) and it ran with no problems. Does anyone have recommendations/buildpacks/alternatives to resolve this?

OpenCV Version: 3.4.2.16

Python: 3.7

Current Buildpacks:

  • https://github.com/cstavish/heroku-buildpack-vips.git

  • https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git

  • https://github.com/heroku/heroku-buildpack-apt

  • heroku/python

  • https://github.com/timanovsky/subdir-heroku-buildpack

Open Cv Build info (Video) from the Heroku Dyno

Video I/O:
DC1394:                      NO
FFMPEG:                      YES
avcodec:                   YES (ver 58.21.104)
avformat:                  YES (ver 58.17.101)
avutil:                    YES (ver 56.18.102)
swscale:                   YES (ver 5.2.100)
avresample:                NO
GStreamer:                   NO
libv4l/libv4l2:              NO
v4l/v4l2:                    linux/videodev.h linux/videodev2.h
gPhoto2:                     NO

Edit: Here is our code that's running into problems:

cap = cv.VideoCapture(video_url)
print(cap.isOpened())

With this code, we noticed the print statement consistently says False when using a URL similar to one provided by youtubeDL.