0

I want to get an image from url video stored on s3 bucket. I tried to do it with cv2.VideoCapture but it only works with static file. If someone can help me

  • Welcome to StackOverflow. Please read [How to Ask](https://stackoverflow.com/help/how-to-ask) and show us what you have tried, before we can help you out here. – Antimony Oct 09 '17 at 02:04
  • Possible duplicate of [How to read remote video on Amazon S3 using ffmpeg](https://stackoverflow.com/questions/2677317/how-to-read-remote-video-on-amazon-s3-using-ffmpeg) – Harry Oct 11 '17 at 17:43

2 Answers2

1

I think its too late but I'm writing this for other facing same problem, since I was trying but couldn't found any solution.

So you have to set up amazon cloudfront download distribution pointing to your S3 bucket (if don't know how to setup please see here) and then simply access using http (not https, don't know why it not working with https or directly via s3 url).

Just put cloudfront url as:

cv2.VideoCapture('http://xyz.cloudfront.net/myvideo.mp4')

Now it will work fine.

Kashif Anwar
  • 180
  • 1
  • 12
0

A presigned url for S3 object can be used.

url = s3_client.generate_presigned_url( ClientMethod='get_object', Params={ 'Bucket': bucket, 'Key': key } )

vidcap = cv2.VideoCapture(url)

Jay
  • 179
  • 1
  • 9