Save streamed video from KinesisVideoStream using boto3 to a local file

烈酒焚心 提交于 2019-12-11 05:34:07

问题


So I have a stream going on in KVS. I am trying to save it (in chunks of 1 min for example) However, when saving the botocore.response.StreamingBody, I am getting only 1 sec video.

Here is the code I am using:

 client = boto3.client('kinesis-video-media', endpoint_url=url)
 response = client.get_media(
            StreamARN=MyARN,
            StartSelector={
            'StartSelectorType': 'EARLIEST',
            })
 with open('test.webm', 'w+') as f:
     chunk = response['Payload'].read(1024*8)
     while chunk:
         f.write(chunk)
         chunk = response['Payload'].read(1024*8)

How can I make it 1 minute video files?

Thank you!

来源:https://stackoverflow.com/questions/53516866/save-streamed-video-from-kinesisvideostream-using-boto3-to-a-local-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!