4

Running Rasbian OS on Raspberry Pi B

From dmesg:

[139215.134634] usb 1-1.3: new high-speed USB device number 7 using dwc_otg
[139216.356892] usb 1-1.3: New USB device found, idVendor=046d, idProduct=082d
[139216.356929] usb 1-1.3: New USB device strings: Mfr=0, Product=2, SerialNumber=1
[139216.356946] usb 1-1.3: Product: HD Pro Webcam C920
[139216.356961] usb 1-1.3: SerialNumber: CF47B63

I followed this tutorial: https://www.raspberrypi.org/documentation/usage/webcams/

But when I type fswebcam image.jpg I get:

--- Opening /dev/video0...
stat: No such file or directory

My guess is that there are no drivers installed for the Logitech c920 on my pi, but I'm not sure. How would I download drivers or what should I do to be able to use my webcam? The c920 is on the list of approved webcams, I have nothing else being powered by my pi so I should have enough power output to take a simple picture.

  • I find myself in the same predicament only update, upgrade and rpi-upgrade did not fix it. Any more tips on how to fix this? here is the output of dmesg | grep Webcam: [ 3.161322] usb 1-1.4: Product: Webcam C170 sorry for posting this as an answer but I don't yet have enough reputation to comment. – Timis Daniel Jan 19 '16 at 11:55
4

Could it be something as simple as the camera being recognized as something other than /dev/video0? Does ls /dev/video* yield anything else?

It's been many months since I used a C920 on my Raspberry Pi, but at the time, everything "just worked" so long as I used the right device.

  • 1
    I get: ls: cannot access /dev/video0: No such file or directory – skrhee Apr 18 '15 at 17:42
  • 1
    how about ls /dev/video* (note the asterisk). Depending on what you've been doing, it's possible the camera might show up as a different device (e.g. /dev/video1). Check the output of lsusb to make sure the camera is seen. – bobstro Apr 18 '15 at 22:03
  • 1
    no device found with the asterisk, and with lsusb it says BUS 001 Device 008: ID 046d:082d Logitech, Inc. – skrhee Apr 18 '15 at 22:06
  • 1
    I just plugged my C920 into a RPi B2 running a fresh raspbian install, and it's recognized as /dev/video0. Is your firmware up to date? Have you run rpi-update? Is your raspbian up to date? (sudo apt-get update; sudo apt-get dist-upgrade) – bobstro Apr 19 '15 at 3:30
  • 1
    Okay now my webcam is recognized but anytime I try to run a code i get vidioc_querymenu: invalid argument do you know what is happening? – skrhee Apr 25 '15 at 20:34
4

I spent a number of hours recently with my C920 and a Raspberry Pi 3 recently to make a babyCam that I could stream within my home network. I may be able to shed some light but also provide documentation and experience to other users.

OK, to use the Video4Linux2 driver to find the camera's video device do this:

v4l2-ctl --list-devices

My experience:

  • I can decode the video on VLC on Mac (v2.2.4)
  • I can decode the video on VLC for iPhone
  • the playback URL in VLC is "rtsp://{ip_or_hostname_of_the_Pi}:8554/"
  • expect the audio to be heard first and typically about 5-10 seconds for the video to come through.
  • Add-on commercial decoders for Windows Media Player such as VBrick's StreamPlayer product should decode an rtsp transport stream. VBrick's playback url would be something like rtspu://{ip_or_hostname_of_the_Pi}:8554/" but I haven't tested it. The syntax can be a bit whacky.

The C920's H.264 encoder is good but its rate seems only works at 3 Mb/s average bit rate no matter what the resolution. However, I tend to use 720p, that is 1280x720 because a 16:9 aspect ratio makes sense for the application.

I have to transcode the raw audio and I found it tricky to get vlc 2.2.1 built for Raspbian to be tricky -- I end up using mp2a audio.

I do not recommend trying to transcode the video because then the Pi's CPU's go working on overtime.

VLC has a delay of 1-3 seconds.

VLC's rtp server seemed lousy. VLC's Transport Stream (ts) is decent. These steps are for using the camera's internal H.264 encoder (pixelformat=1):

  1. Pre-configure the camera: sudo v4l2-ctl --device=/dev/video0 --set-fmt-video=width=1280,height=720,pixelformat=1
  2. cvlc -I dummy v4l2:///dev/video0:chroma=h264:width=1280:height=720 :input-slave="alsa://plughw:CARD=C920,DEV=0" --sout '#transcode{acodec=mp2a,ab=96,channels=2}:rtp{sdp=rtsp://:8554/,mux=ts}' -v

the audio was more difficult than the video. To test audio you can try to use alsa's arecord. I used

arecord -L

to get the device names. Now, I found the name "plughw:CARD=C920,DEV=0" which arecord described as "Hardware device with all software conversions"

On testing the camera's audio, I recorded and listened to the WAV file I recorded to the Pi's local storage. Unfortunately with this recipe, you'll need to Ctrl-C after 10 seconds. Cleanup the extra record files. So I can record good sound from the camera with this command to a wav file but I can't make arecord stop at 10 seconds:

arecord -d 10 -t wav -D plughw:CARD=C920,DEV=0 -f cd --max-file-time 10 recordcam.wav
  • Thank you very much. I've spent several days on this - RPI3 + ubuntu-server and similar camera :) – zubozrout Oct 31 '16 at 20:29
  • Though it still doesn't work ideally for me - first time I start VLC stream I seem to have no audio but if I kill VLC and start it again it works. And there doesn't appear to be any errors present. – zubozrout Nov 2 '16 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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