I've tried cheese and wxCam and both of those record the video fine, but there is no audio in the videos. How can i record a video from my webcam with audio as well?
Ubuntu – Recording video with audio from webcam
soundvideowebcam
Related Solutions
OSS was the only audio API in Linux up through the 2.4 series of official (kernel.org) Linux kernels. ALSA was added starting with 2.5, and in those versions, Linux kernel authors marked OSS as deprecated. 4Front continued to develop OSS outside the Linux kernel.
Source: Open Sound System - Wikipedia
Locate the sound device using arecord -L
. Then use it in the commandline. The output is very extensive.
This will record 30 seconds of video from my webcam:
$ ffmpeg -f alsa -i plughw:CARD=C525,DEV=0 -f video4linux2 -s 320x240 -i /dev/video0 -t 30 out.mpg
The arecord output on my system is entered below with the audio device I chose to use highlighted in bold. In this case it's plughw:CARD=C525,DEV=0.
default Playback/recording through the PulseAudio sound server null Discard all samples (playback) or generate zero samples (capture) pulse PulseAudio Sound Server sysdefault:CARD=MID HDA Intel MID, ALC889A Analog Default Audio Device front:CARD=MID,DEV=0 HDA Intel MID, ALC889A Analog Front speakers surround21:CARD=MID,DEV=0 HDA Intel MID, ALC889A Analog 2.1 Surround output to Front and Subwoofer speakers surround40:CARD=MID,DEV=0 HDA Intel MID, ALC889A Analog 4.0 Surround output to Front and Rear speakers surround41:CARD=MID,DEV=0 HDA Intel MID, ALC889A Analog 4.1 Surround output to Front, Rear and Subwoofer speakers surround50:CARD=MID,DEV=0 HDA Intel MID, ALC889A Analog 5.0 Surround output to Front, Center and Rear speakers surround51:CARD=MID,DEV=0 HDA Intel MID, ALC889A Analog 5.1 Surround output to Front, Center, Rear and Subwoofer speakers surround71:CARD=MID,DEV=0 HDA Intel MID, ALC889A Analog 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers dmix:CARD=MID,DEV=0 HDA Intel MID, ALC889A Analog Direct sample mixing device dmix:CARD=MID,DEV=2 HDA Intel MID, ALC889A Alt Analog Direct sample mixing device dsnoop:CARD=MID,DEV=0 HDA Intel MID, ALC889A Analog Direct sample snooping device dsnoop:CARD=MID,DEV=2 HDA Intel MID, ALC889A Alt Analog Direct sample snooping device hw:CARD=MID,DEV=0 HDA Intel MID, ALC889A Analog Direct hardware device without any conversions hw:CARD=MID,DEV=2 HDA Intel MID, ALC889A Alt Analog Direct hardware device without any conversions plughw:CARD=MID,DEV=0 HDA Intel MID, ALC889A Analog Hardware device with all software conversions plughw:CARD=MID,DEV=2 HDA Intel MID, ALC889A Alt Analog Hardware device with all software conversions sysdefault:CARD=HDMI USB Capture HDMI, USB Audio Default Audio Device front:CARD=HDMI,DEV=0 USB Capture HDMI, USB Audio Front speakers surround21:CARD=HDMI,DEV=0 USB Capture HDMI, USB Audio 2.1 Surround output to Front and Subwoofer speakers surround40:CARD=HDMI,DEV=0 USB Capture HDMI, USB Audio 4.0 Surround output to Front and Rear speakers surround41:CARD=HDMI,DEV=0 USB Capture HDMI, USB Audio 4.1 Surround output to Front, Rear and Subwoofer speakers surround50:CARD=HDMI,DEV=0 USB Capture HDMI, USB Audio 5.0 Surround output to Front, Center and Rear speakers surround51:CARD=HDMI,DEV=0 USB Capture HDMI, USB Audio 5.1 Surround output to Front, Center, Rear and Subwoofer speakers surround71:CARD=HDMI,DEV=0 USB Capture HDMI, USB Audio 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers iec958:CARD=HDMI,DEV=0 USB Capture HDMI, USB Audio IEC958 (S/PDIF) Digital Audio Output dmix:CARD=HDMI,DEV=0 USB Capture HDMI, USB Audio Direct sample mixing device dsnoop:CARD=HDMI,DEV=0 USB Capture HDMI, USB Audio Direct sample snooping device hw:CARD=HDMI,DEV=0 USB Capture HDMI, USB Audio Direct hardware device without any conversions plughw:CARD=HDMI,DEV=0 USB Capture HDMI, USB Audio Hardware device with all software conversions sysdefault:CARD=C525 HD Webcam C525, USB Audio Default Audio Device front:CARD=C525,DEV=0 HD Webcam C525, USB Audio Front speakers surround21:CARD=C525,DEV=0 HD Webcam C525, USB Audio 2.1 Surround output to Front and Subwoofer speakers surround40:CARD=C525,DEV=0 HD Webcam C525, USB Audio 4.0 Surround output to Front and Rear speakers surround41:CARD=C525,DEV=0 HD Webcam C525, USB Audio 4.1 Surround output to Front, Rear and Subwoofer speakers surround50:CARD=C525,DEV=0 HD Webcam C525, USB Audio 5.0 Surround output to Front, Center and Rear speakers surround51:CARD=C525,DEV=0 HD Webcam C525, USB Audio 5.1 Surround output to Front, Center, Rear and Subwoofer speakers surround71:CARD=C525,DEV=0 HD Webcam C525, USB Audio 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers iec958:CARD=C525,DEV=0 HD Webcam C525, USB Audio IEC958 (S/PDIF) Digital Audio Output dmix:CARD=C525,DEV=0 HD Webcam C525, USB Audio Direct sample mixing device dsnoop:CARD=C525,DEV=0 HD Webcam C525, USB Audio Direct sample snooping device hw:CARD=C525,DEV=0 HD Webcam C525, USB Audio Direct hardware device without any conversions plughw:CARD=C525,DEV=0 HD Webcam C525, USB Audio Hardware device with all software conversions
A lot of the many devices can be eliminated based on the audio you are trying to capture, such as the surround sound and in my case other HDMI capture devices.
Best Answer
I had a similar problem with cheese (that is, video was fine, but no audio).
I tried out guvcview based on this answer. This didn't work either, but then I remembered something about USB 3 ports not working with devices like webcams sometimes, so I moved it to a USB 2 port.
Everything worked in guvcview just fine then. The webcam appeared as a new audio device ("USB Audio"). guvcview seems like a neat little application, with a lot of options for how to record from the cam.
(I tried cheese again to see if it was purely the USB 3 port as the cause, but it still didn't work.)