Bir ses akışından öğrenen tensorflow projesinde çalışıyorum. Altprogram modülünü (Popen
ile) ve bir mp3'den ses verilerini okumak için FFMPEG kullanıyorum. Ses dosyasını Popen()
ile başarıyla açtım ve çıkışı stdout
üzerinden yazdırabilirim. Ancak, onu yakalayamıyorum.Python yakalama altişlem çıktısı
denedim hem read()
ve communicate()
Ben here
read()
basitçe hiçbir şey döner ve communicate()
hata atıyor bir öğretici takip ediyorum:
for image_index, image in enumerate(image_files):
count += 1
image_file = os.path.join(folder, image)
try:
output_files = "output/output" + str(count) + ".png"
if image_file != 'train/rock/.DS_Store':
command = [FFMPEG_BIN,
'-i', image_file,
'-f', 's16le',
'-acodec', 'pcm_s16le',
'-ar', '44100',
'-ac', '2',
output_files]
pipe = sp.Popen(command, stdout=sp.PIPE)
print (pipe)
raw_audio = pipe.stdout.communicate(88200*4)
:
AttributeError: 'file' object has no attribute 'communicate'
İşte
kod bu
Ben stdout'u iletişim gelmiştir herşeyi here ve here
teşekkür ederiz! Kafamı duvara çarpıyordum ve tabii ki basit bir şey. Print (raw_audio) 'nun yazdırılmasının bir nedeni var mı? ('', Yok)'? –
@KendallWeihe, 'stderr = sp.STDOUT' –
' Popen 'öğesine eklemeyi deneyin. Şimdi sadece bu son çıkışı ' –