【发布时间】:2020-01-15 11:45:24
【问题描述】:
我有如下形式的音频字节:
b'ID3\x04\x00\x00\x00\x00\x00#TSSE\x00\x00\x00\x0f\x00\x00\x03Lavf57.71.100\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\...
我从亚马逊网络服务获得的:
import boto3
client = boto3.client('polly')
response = client.synthesize_speech(
Engine='neural',
LanguageCode='en-GB',
OutputFormat='mp3',
SampleRate='8000',
Text='hey whats up this is a test',
VoiceId='Brian'
)
我想将它输入到moviepy音频文件中使用
AudioFileClip()
AudioFileClip 采用文件名或代表声音的数组。我知道我可以将音频保存为文件并读取它,但我想让 AudioFileClip 获取上面显示的字节输出。
我试过了:
AudioFileClip(response['AudioStream'].read())
但这给出了错误:
TypeError: endswith first arg must be bytes or a tuple of bytes, not 字符串
我能做什么?
【问题讨论】:
标签: python-3.x amazon-web-services audio boto3 audio-streaming