aeddi / aws-lambda-python-opencv

Simple script that builds an AWS Lambda deployment package including OpenCV

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VideoCapture not working.

visibleajay opened this issue · comments

Thanks for providing a viable solution to us.

I was using cv2.VideoCapture(SourcePath) to parse the video using opencv.

But after installing opencv using provided solution, I am unable to run the video using cv2.VideoCapture.

After googling for some time, I get to know that the FFMPEG file is missing from the package.

Is their any solution for parsing video in lambda function.

Regards
Ajay

commented

Looking at the output from cmake would suggest that the video module is available but due to the lack of ffmpeg on amazon linux you would have to build it some other way.

the output from cmake looks like this

--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  NO
--     FFMPEG:                      NO
--       avcodec:                   NO
--       avformat:                  NO
--       avutil:                    NO
--       swscale:                   NO
--       avresample:                NO
--     GStreamer:                   NO
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     OpenNI2:                     NO
--     PvAPI:                       NO
--     GigEVisionSDK:               NO
--     Aravis SDK:                  NO
--     UniCap:                      NO
--     UniCap ucil:                 NO
--     V4L/V4L2:                    NO/YES
--     XIMEA:                       NO
--     Xine:                        NO
--     gPhoto2:                     NO

As you can see V4L is there (Video for Linux) so Video will work but its unlikely your codec will be supported without FFMpeg

You will need to fetch the source of FFMpeg, build it, then point the opencv cmake to it to get opencv to link against it. Finally then you would need to include the built FFMpeg libs in the cv2 directory of the lambda package.

I'll give it a go and submit a patch if I get it working

I have the same problem and would appreciate if you could share the solution. How to install and link ffmpeg to opencv for use in AWS Linux (lambda)?

@p0wdrdotcom is right. (thanks for your detailed answer)
To get VideoCapture working you'll have to build, link and include all the needed dependencies into your module package.
I don't have any time to work on this for the moment but if someone send me a pull request I'll merge the change with the main repo.