maartenbreddels / ipywebrtc

WebRTC for Jupyter notebook/lab
MIT License
243 stars 40 forks source link

Convert audio recording in 'webm' to 'flac' format #100

Open Vishav3 opened 3 years ago

Vishav3 commented 3 years ago

I am trying to convert audio recording in webm format to 'flac' Below is my code:

import time camera = CameraStream(constraints={'audio': True,'video': False}) recorder = AudioRecorder(stream=camera, format='webm') recorder.recording = True time.sleep(5) recorder.recording = False recorder.audio.autoplay = False ipd.display(recorder.audio) with BytesIO(recorder.audio.value) as f: audioFile = AudioSegment.from_file(f, format='webm') with BytesIO() as f: audioFile.export(f, format='flac') audioBytes = f.getvalue()

I am getting the following error: image

Can anyone suggest where I am going wrong?

maartenbreddels commented 1 year ago

Not related to this project, still curious if you managed to solve this.