vhyrbi
Posts: 1
Joined: Wed Jan 16, 2013 8:14 am

Logitech C920/H264 and Raspberry Pi

Wed Jan 16, 2013 8:45 am

Hi,

the Logitech C920 webcam has a H264 hardware-based coder for video stream. I want to use it with my Raspberry Pi so the board only has to stream the video on the network: all the coding stuff is done by the webcam. Actually, it is already done with the Beaglebone, a detailed walkthrough exists there: http://www.oz9aec.net/index.php/gstream ... -gstreamer

I tried to do the same thing with the Raspberry Pi. It works, but the stream has lots of invalid interframes, the video has lots of junk in the image. I used GStreamer, but I also tried with VLC as a RTSP/RTP server. I did some tests with Raspbian (soft-float and hard-float version) and Arch which have different kernel/vlc/gstreamer versions.

I did the same thing with my computer, and the stream works pretty well. I also made sure it was not a network problem: no frame is lost on the network.

I suppose it is related to the USB packet loss problem I have read about in the forum. I tried several options detailed in the threads USB Packet Loss and Issue 19 on GitHub.

But I still have this problem.

Did somebody else had this problem and managed to solve it?
Any idea about how I could confirm it is really due to USB packet loss or whether there is another problem?

Thank you!

tcl2013
Posts: 2
Joined: Wed Jan 23, 2013 8:09 am

Re: Logitech C920/H264 and Raspberry Pi

Wed Jan 23, 2013 8:45 am

Hi,

I'm faced with the same problem. In this thread:
http://www.raspberrypi.org/phpBB3/viewt ... 6&p=260011
I found a useful trace command:

Code: Select all

echo 0xFF > /sys/module/uvcvideo/parameters/trace
Checking the /var/log/kern.log, I found a lot of "USB isochronous frame lost". Compared to the number of successfully received USB iso frames, the percentage of lost frames is 38 % !

Code: Select all

Jan 23 09:10:59 raspberrypi kernel: [ 1493.038259] uvcvideo: Queuing buffer 1.
Jan 23 09:10:59 raspberrypi kernel: [ 1493.038691] uvcvideo: uvc_v4l2_poll
Jan 23 09:10:59 raspberrypi kernel: [ 1493.045987] uvcvideo: USB isochronous frame lost (-63).
Jan 23 09:10:59 raspberrypi kernel: [ 1493.074113] uvcvideo: Frame complete (EOF found).
Jan 23 09:10:59 raspberrypi kernel: [ 1493.074141] uvcvideo: EOF in empty payload.
Jan 23 09:10:59 raspberrypi kernel: [ 1493.078230] uvcvideo: USB isochronous frame lost (-63).
Jan 23 09:10:59 raspberrypi kernel: [ 1493.106363] uvcvideo: Frame complete (EOF found).
Jan 23 09:10:59 raspberrypi kernel: [ 1493.106391] uvcvideo: EOF in empty payload.
Jan 23 09:10:59 raspberrypi kernel: [ 1493.110489] uvcvideo: USB isochronous frame lost (-63).
Jan 23 09:10:59 raspberrypi kernel: [ 1493.138617] uvcvideo: Frame complete (EOF found).
Jan 23 09:10:59 raspberrypi kernel: [ 1493.138646] uvcvideo: EOF in empty payload.
Jan 23 09:10:59 raspberrypi kernel: [ 1493.142743] uvcvideo: USB isochronous frame lost (-63).
Jan 23 09:10:59 raspberrypi kernel: [ 1493.170848] uvcvideo: Frame complete (EOF found).
Jan 23 09:10:59 raspberrypi kernel: [ 1493.170876] uvcvideo: EOF in empty payload.
Jan 23 09:10:59 raspberrypi kernel: [ 1493.175120] uvcvideo: USB isochronous frame lost (-63).
Jan 23 09:10:59 raspberrypi kernel: [ 1493.207285] uvcvideo: Frame complete (EOF found).
Jan 23 09:10:59 raspberrypi kernel: [ 1493.207313] uvcvideo: EOF in empty payload.
Jan 23 09:10:59 raspberrypi kernel: [ 1493.239513] uvcvideo: Frame complete (EOF found).
Jan 23 09:10:59 raspberrypi kernel: [ 1493.239542] uvcvideo: EOF in empty payload.
Jan 23 09:10:59 raspberrypi kernel: [ 1493.239758] uvcvideo: uvc_v4l2_poll
Jan 23 09:10:59 raspberrypi kernel: [ 1493.239806] uvcvideo: uvc_v4l2_ioctl(VIDIOC_DQBUF)
I think that this is a clear proof that the problem is caused by USB packet loss.
The iso packets are transferred every 32 ms, this should be enough time to transfer a packet of some KB's in size. Reducing the cam's H.264 initial-bitrate e.g. from 6 to 1 Mbps changes nothing: still 38 % frame loss.
At the moment, I have no idea how to further examine or even fix this problem.
Perhaps USB bulk mode would perform better, but I don't know, if this cam supports bulk mode and how to configure the uvc driver to switch to this transfer mode.

--Thomas
--Thomas

nioyco
Posts: 7
Joined: Wed Feb 27, 2013 1:23 am

Re: Logitech C920/H264 and Raspberry Pi

Wed Feb 27, 2013 1:25 am

hi,

Any news??

tcl2013
Posts: 2
Joined: Wed Jan 23, 2013 8:09 am

Re: Logitech C920/H264 and Raspberry Pi

Wed Feb 27, 2013 12:39 pm

Hi,

no news from my side. I stopped all RPI activities. Maybe I'll give it a new try when promising bug fixes for the USB packet loss issue should be available. Watch the USB driver code repository at: [url]https://github.com/raspberrypi/linux/tr ... st/dwc_otg[/url].
The USB controller is an IP core from Synopsys. The driver code is obviouslys also provided by Synopsys. No chance to understand it without a detailed USB controller spec. which is not publicly available.
--Thomas


kalehrl
Posts: 350
Joined: Tue Jul 24, 2012 10:49 am

Re: Logitech C920/H264 and Raspberry Pi

Wed Feb 27, 2013 7:07 pm

Unless we're waiting for Godot. :mrgreen:

BerryPicker
Posts: 177
Joined: Tue Oct 16, 2012 3:03 pm
Location: The East of England

Re: Logitech C920/H264 and Raspberry Pi

Wed Feb 27, 2013 10:28 pm

tcl2013 wrote:The USB controller is an IP core from Synopsys. The driver code is obviouslys also provided by Synopsys. No chance to understand it without a detailed USB controller spec. which is not publicly available.
I came across the following item in which Hans Petter Selasky suggests that documentation is available.
Raspberry PI gets USB support [FreeBSD 10 current]
http://lists.freebsd.org/pipermail/free ... 04099.html

BTW: Checking the /var/log/kern.log my Pi has 90% frame loss

nerdlogger
Posts: 3
Joined: Sun Nov 10, 2013 2:34 am

Re: Logitech C920/H264 and Raspberry Pi

Sun Nov 10, 2013 4:17 am

Working recipe of what you were trying to do.....might still be helpful.

http://nerdlogger.com/2013/11/09/stream ... one-black/

TTYL
Nerdlogger

Return to “Troubleshooting”