Results 1 to 6 of 6

Thread: how to specify capture audio device in VLC?

  1. #1
    Join Date
    Nov 2009
    Location
    Bangalore,India
    Posts
    67

    Default how to specify capture audio device in VLC?

    I need to capture from my webcam. It has a mic too.

    I can specify video input device as /dev/video0.

    I specified input audio device as /dev/dsp2 ( OSS device, corresponding to USB Webcam), Now VLC throws an error, "VLC is unable to open the MRL 'alsa:///dev/dsp2'. Check the log for details"

    Thinking it wants an alsa device, I specify device as /dev/snd/pcmC2D0c. (got it from kinfocenter and dolphin). Now again an error, "VLC is unable to open the MRL 'alsa:///dev/snd/pcmC2D0c'. Check the log for details.".

    I try with any device, the same error. I have added myself to audio device so that I can read/write to the mentioned devices.

    I see no way of switching VLC to use OSS. And I see no information (documentation on net) on it's expected device listing for audio.

    If I do not specify device, the default mic is used which is not good

    How to specify audio device for VLC?

  2. #2
    Join Date
    Mar 2008
    Location
    Europe
    Posts
    25,934
    Blog Entries
    30

    Default Re: how to specify capture audio device in VLC?

    If you are not fixated on vlc, there are webcam applications that provide this capability (such as guvcview).

    I provided in my (new) openSUSE blog a means of capturing video and audio of the entire desktop: Capturing video of one's desktop - Blogs - openSUSE Forums

    If you are using openSUSE-11.4 then rather than try to specify a device such as 'alsa:///dev/dsp2' you could you not simply specify 'pulse' ? You may need the application phonon-backend-vlc for this to work ( I'm not so sure on that ).

    And you may need to install 'pavucontrol' (pulse audio volume control) so as to control the input/output of pulse audio. The 'pavucontrol' application provides superb control over the device/application direction in one's audio which IMHO was only possible before with more advanced applications such as 'jack'.

    I have not tried to do with what you have attempted with vlc (because I have easier/better applications to do this). But if I do get arround to attempting it and succeed, I'll post here.

  3. #3
    Join Date
    Mar 2008
    Location
    Europe
    Posts
    25,934
    Blog Entries
    30

    Default Re: how to specify capture audio device in VLC?

    Quote Originally Posted by oldcpu View Post
    I provided in my (new) openSUSE blog a means of capturing video and audio of the entire desktop: Capturing video of one's desktop - Blogs - openSUSE Forums
    Replying to my own post (?) < gulp ... that's a bit Freudian > I don't think my blog entry will likely be of much help. Sorry. But when it comes to tuning pulse audio, you may find this thread of use: Looking (maybe) for audio mixer for use with Pulse Audio starting in post#4.

  4. #4
    Join Date
    Mar 2008
    Location
    Europe
    Posts
    25,934
    Blog Entries
    30

    Default Re: how to specify capture audio device in VLC?

    Quote Originally Posted by pbhat View Post
    How to specify audio device for VLC?
    Ok, I took a look at this specific question, and I think it is straightforward and easy (once one knows how, and difficult if one does not know how - which is always the case. Sorry 'bout that! ).

    Type in a terminal:
    Code:
    arecord -l
    and pay attention to your hardware devices.

    For example, on my PC I get:
    Code:
    **** List of CAPTURE Hardware Devices ****
    card 0: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]
      Subdevices: 3/3
      Subdevice #0: subdevice #0
      Subdevice #1: subdevice #1
      Subdevice #2: subdevice #2
    card 1: U0x46d0x821 [USB Device 0x46d:0x821], device 0: USB Audio [USB Audio]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    From that you can see my regular mic is "hw:0,0" and my webcam mic: "hw:1,0".

    So for my webcam mic I would put: hw:1,0

    Check out that concept and see if it works.

    I confess I do not know how to stream to a file with vlc (likely easy once one knows how).

  5. #5
    Join Date
    Nov 2009
    Location
    Bangalore,India
    Posts
    67

    Default Re: how to specify capture audio device in VLC?

    Thanks oldcpu for such detailed help. It was useful

    Yes, specifying audio device as ' hw:x,y' works in vlc. But when I specified my USB webcam Audio like that, it produces a harsh sound for a few seconds and then the sound dies in the capture. Also, inexplicable, vlc stops streaming after a few secs sometimes. Sometimes it works.

    I tried wxcam which is an excellent application, small, compact. works very well, though I did not like having wxwidgets support for this application. It produces best sound, best picture.

    With ffmpeg, I had no succes, however. I was disappointed for it's failure. It complains like below.

    [video4linux2 @ 0x80862e0] The V4L2 driver ioctl set standard(NTSC) failed
    [video4linux2 @ 0x80862e0] Could not find codec parameters (Invalid Codec type -1)
    [video4linux2 @ 0x80862e0] Estimating duration from bitrate, this may be inaccurate
    /dev/video0: could not find codec parameters
    The pixel format of the video from webcam is identified as YUY2 by vlc and YUYV by wxcam. Both capture it well. But this is not automatically recognised by ffmpeg. After I got the info from vlc, I changed my command line as,

    ffmpeg --f rawvideo -pix_fmt uyvy422 -i /dev/video0 out.mpg
    [IMGUTILS @ 0xbfc43cc4] Picture size 0x0 is invalid
    [IMGUTILS @ 0xbfc43bd4] Picture size 0x0 is invalid
    [rawvideo @ 0x80862e0] Could not find codec parameters (Video: rawvideo, uyvy422)
    [rawvideo @ 0x80862e0] Estimating duration from bitrate, this may be inaccurate
    /dev/video0: could not find codec parameters
    ffmpeg -f video4linux2 -f rawvideo -pix_fmt yuyv422 -i /dev/video0 out.mpg
    [IMGUTILS @ 0xbfc43cc4] Picture size 0x0 is invalid
    [IMGUTILS @ 0xbfc43bd4] Picture size 0x0 is invalid
    [rawvideo @ 0x80862e0] Could not find codec parameters (Video: rawvideo, yuyv422)
    [rawvideo @ 0x80862e0] Estimating duration from bitrate, this may be inaccurate
    /dev/video0: could not find codec parameters
    But it does not stop complaining !! I do not know what I am missing. It seems to have support for this packed YUV compresssed format of raw video, but I accnot figure out what more to specify.

    Thanks,

  6. #6
    Join Date
    Mar 2008
    Location
    Europe
    Posts
    25,934
    Blog Entries
    30

    Default Re: how to specify capture audio device in VLC?

    Quote Originally Posted by pbhat View Post
    Yes, specifying audio device as ' hw:x,y' works in vlc. But when I specified my USB webcam Audio like that, it produces a harsh sound for a few seconds and then the sound dies in the capture. Also, inexplicable, vlc stops streaming after a few secs sometimes. Sometimes it works.
    Are you certain its the audio capture causing the problem, and possibly not also the video ? What can you tell us about your webcam ? ie what is the output for the webcam line from running the command:
    Code:
    lsusb
    Quote Originally Posted by pbhat View Post
    I tried wxcam which is an excellent application, small, compact. works very well, though I did not like having wxwidgets support for this application. It produces best sound, best picture.

    With ffmpeg, I had no success, however. I was disappointed for it's failure. It complains like below.
    ..... deleted ....
    I am NOT skilled with the ffmpeg command, although I have managed to get it working for some neat things (such as a complete screen capture of my desktop).

    I note that the errors you get with ffmpeg that there is a BUG in the packman packaged ffmpeg (which originated upstream) and the command you used gives the error:
    Code:
    The V4L2 driver ioctl set standard(NTSC) failed
    and we need to wait for the fix to come downstream.

    I note this reference for the bug report (dated 28-May-2011): FFmpeg-users - Problem with video4linux2

    You could post about this bug on the Packman mailing list and ask they rebuild ffmpeg with from the latest git version.

    = = =

    As an aside, you may be interested that this command will capture the entire screen with audio:

    Code:
    ffmpeg -f alsa -ac 2 -i hw:1,0 -f x11grab -r 15 -s 1920x1200 -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 output.avi
    Where "hw:1,0: is my webcam mic. I am capturing at 15 fps. And I am capturing at the resolution of 1920x1200.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •