Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using ffmpeg arecord -L, I am able to identify my Logitech usb webcam as:

USB Device 0x46d:0x821, USB Audio
Direct hardware device without any conversions

USB Device 0x46d:0x821, USB Audio
Hardware device with all software conversions

when I go into /dev/snd/by-id, the webcam is described as:

usb-046d_0821_6813BFD0-00 -> ../controlC1

I know that the command to use a sound device in ffmpeg is

ffmpeg -f alsa -i $ALSA_DEVICE_NAME..

I have tried

ffmpeg -f alsa -i "hw:CARD=U0x46d0x821,DEV=0" and

ffmpeg -f alsa -i "plughw:CARD=U0x46d0x821,DEV=0"

and in both cases I receive the same error message

ALSA lib pcm.c:2208:(snd_pcm_open_noupdate) Unknown PCM hw=CARD=U0x46d0x821,DEV=0
[alsa @ 0x9c96580] cannot open audio device hw=CARD=U0x46d0x821,DEV=0 (No such file or directory)
hw:CARD=U0x46d0x821,DEV=0: Input/output error

I have also tried

ffmpeg -f alsa -i "usb-046d_0821_6813BFD0-00" and

ffmpeg -f alsa -i "usb-046d_0821_6813BFD0-00,DEV=0" and have still received error message

Could use some help in formulating the correct format of the command

share|improve this question

The following is the correct way:

  1. Issue the arecord -L command.
  2. Look for the plughw values which corresponds to your hardware. Please note that plughw represents a hardware which has been plugged into the computer.
  3. Crosscheck the values in /dev/snd/by-id directory.
    • When you unplug the webcam(s), the by-id sub directory will vanish from the /dev/snd directory. This is an excellent test to confirm which plughw is an externally plugged in device.
  4. The sound device(s) ID listed there will be the same as or correspond to one of the values obtained from the arecord -L command.
  5. The command to use is ffmpeg: -f alsa -i plughw.
  6. Please note, do NOT enclose the plughw value in quotes.
  7. A working example for me was:

    ffmpeg -f alsa -i plughw:CARD=U0x46d0x821,DEV=0 -acodec libmp3lame -t 20 output.mp4
  8. You may add the video portion to the above command by adding:

    -f video4linux2 -i /dev/video0

I hope this helps. Any related question(s) is/are welcome.

share|improve this answer

I had a quick read of the man page for ffmpeg and they recommend looking in /proc/asound/cards

I have two cards on my machine 0 and 1 and my web cam is 1 so the command for me is

ffmpeg -f alsa -i hw:1
share|improve this answer
Thanks for your suggestion. I did try it and it didn't work. I however retried <b> arecord -L </b> and used the <b>plughw:....</b> value, this time without enclosing the value in quotes and that did work – user1545779 Jul 25 '12 at 17:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.