如何从S3将mp4文件直接读入moviepy?

时间:2019-04-09 12:53:51

标签: python amazon-s3 ffmpeg moviepy

有什么想法如何将S3 mp4文件直接读入moviepy吗?

我尝试过

import boto3
from io import BytesIO
from moviepy.editor import *

client = boto3.client('s3')
obj =  client.get_object(Bucket='some-bucket', Key='some-file')
VideoFileClip(BytesIO(obj['Body'].read())) 

但是我得到了,

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/<path>/lib/python3.6/site-packages/moviepy/video/io/VideoFileClip.py", line 91, in __init__
fps_source=fps_source)
File "/<path>/lib/python3.6/site-packages/moviepy/video/io/ffmpeg_reader.py", line 33, in __init__
fps_source)
File "/<path>/lib/python3.6/site-packages/moviepy/video/io/ffmpeg_reader.py", line 243, in ffmpeg_parse_infos
is_GIF = filename.endswith('.gif')
AttributeError: '_io.BytesIO' object has no attribute 'endswith'

路径是我的虚拟环境

0 个答案:

没有答案