Reputation: 11
I want to capture audio to stream in with aiortc, installed on ubuntu 22.04, using python.
I tried av.open(format='alsa', file='default')
and av.open(format='pulse', file='default')
, and got `ValueError: no container format 'alsa'.
So, what can I do to solve it? Thank you
Upvotes: 0
Views: 592
Reputation: 2357
Try this:
def get_available_cameras(self):
devices = FilterGraph().get_input_devices()
available_cameras = {}
for device_index, device_name in enumerate(devices):
available_cameras[device_index] = device_name
return available_cameras
def create_local_tracks(self):
global relay, webcam
options = {"framerate": "30", "video_size": "640x480"}
camera_name = "video="+self.get_available_cameras()[0]
webcam = MediaPlayer(camera_name, format='dshow', options=options)
relay = MediaRelay()
return relay.subscribe(webcam.video)
Upvotes: 0