我尝试使用vGet库,但它返回以下错误:
import struct
import math
import pyaudio
from itertools import count
pa = pyaudio.PyAudio()
FORMAT = pyaudio.paFloat32
CHANNELS = 1
RATE = 44100
OUTPUT_BLOCK_TIME = 0.05
OUTPUT_FRAMES_PER_BLOCK = int(RATE*OUTPUT_BLOCK_TIME)
def sine_gen():
time = 0
format = "%df" % OUTPUT_FRAMES_PER_BLOCK
voices = []
voices.append(lambda sampletime: math.sin(sampletime * math.pi * 2 * 440.0))
for frame in count():
block = []
for i in xrange(OUTPUT_FRAMES_PER_BLOCK):
sampletime = time + (float(i) / OUTPUT_FRAMES_PER_BLOCK) * OUTPUT_BLOCK_TIME
sample = sum(voice(sampletime) for voice in voices) / len(voices)
block.append(sample)
yield struct.pack(format, *block)
time += OUTPUT_BLOCK_TIME
if frame == 20:
voices.append(
lambda sampletime: math.sin(sampletime * math.pi * 2 * 880.0)
)
stream = pa.open(format=FORMAT,
channels=CHANNELS, rate=RATE, output=1)
for i, block in enumerate(sine_gen()):
stream.write(block)
是否有任何其他库或任何类型的解决方案可以从youtube下载视频?
答案 0 :(得分:1)
YouTube一直在改变它的视频管理方式,而vGet并未经常更新,因此vGet无法从Youtube下载视频。