使用OpenCV和SimpleUploadedFi从视频中获取图像

2024-09-27 19:25:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我有以下代码来创建InMemoryUploadedFile。我这样做的原因是因为我使用firebase并在那里保存图像和视频。可以认为它类似于S3存储。。。在我的测试中,我有以下内容:

file = BASE_DIR + '/static/samy-assets/img/landing/small.mp4'
video = SimpleUploadedFile(file, open(file, 'rb').read(), content_type="video/mp4")
response = self.client.post('/media/upload/', {'file': video}, follow=True)

这是为了上传视频到firebase,但是现在我需要从视频中获取一帧作为“预览”显示。我有这个代码:

^{pr2}$

但是我收到的错误是:

an integer is required (got type InMemoryUploadedFile)

任何帮助都将不胜感激。。。在


Tags: 代码图像base视频s3videotypedir

热门问题