fortuna wolf
Posts: 7
Joined: Tue Nov 05, 2013 2:04 pm

Trouble streaming h264 video off a Logitech C920.

Tue Nov 05, 2013 6:50 pm

Hi, I've got a project where I need minimal latency video streaming over IP. For now its on a LAN but I'd like to expand it to over the internet. I intend to stick a camera on a RC car and use the RPI to grab the h264 stream and serve it (as well as receive commands and interface with an arduino to control the car and report on its sensors).

I've settled on using either a Logitech C920 (because it has 1080p30fps with onboard h264 encoding) OR using a raspberry pi camera module. Since I had a C920 already I decided to go with that. I realize that the camera module may give better results...

The C920 has one key frame every 10 seconds (300 frames), and 299 p frames between. I don't have a datasheet on it but in theory it shouldn't have more than 1-3 frames of latency from the camera to encoding it and pushing it out. (100ms max). Transport over my network should incur no more than another 10ms, and decoding should be no more than another 1-2 frames to receive and decode directly to framebuffer with a hardware decoder. I should be looking at 100-150ms latency which should allow me to have perfectly drivable cars.

I installed VLC and mplayer with sudo-apt get install.

I can connect the C920 and use a command from http://wiki.matthiasbock.net/index.php/ ... ming_H.264 to start streaming to http with ts encapsulation.

Code: Select all

cvlc v4l2:///dev/video0:chroma=h264:width=800:height=600 --sout '#standard{access=http,mux=ts,dst=192.168.2.10:8080,name=stream,mime=video/ts}' -vvv
On my windows 7 machine I can open and view the stream in VLC with about 300ms latency (even setting caching to 0). Sadly, my desktop has an older video card and VLC can't do hardware accelerated decoding. I suspect the latency is from the
On a second RPI if I try opening this with mplayer or vlc its an utter mess (one frame, and then its frozen). CPU utilization goes to 100%. Clearly, its trying to decode the stream in software but doesn't have enough horsepower.

So I tried this

Code: Select all

mplayer http://192.168.2.10:8080/ -fs -framedrop -vo fbdev
, which just ended up in a page full of fbdev errors until I got tired and quit.

I have tried a receiving pi to pick up the stream with omxplayer, as well as using the same rpi to open the stream with omxplayer.

Code: Select all

omxplayer http://localhost:8080/
or

Code: Select all

omxplayer http://192.168.2.10:8080/
This results in

Code: Select all

Aspect : num 9 den 8 aspect 1.333333 pixel aspect 1.125000
Video codex omx-h264 width 800 height 600 profile 579 fps 15.000000
Subtitle count: 0, state: off, index: 1, delay: 0
Then, nothing. It just sits there. I have to ctrl-c out of it. Sometimes I don't even get that and just get "have a nice day"

So that's where I am now. Is there another program I can use to hardware decode the stream? Or a way to fix omxplayer?

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

Re: Trouble streaming h264 video off a Logitech C920.

Sun Nov 10, 2013 2:38 am

Hey Fortuna Wolf,

I just finished a full write up of getting C920 to do 1080P Streaming. Might be of interest......

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

TTYL
nerdlogger

fortuna wolf
Posts: 7
Joined: Tue Nov 05, 2013 2:04 pm

Re: Trouble streaming h264 video off a Logitech C920.

Mon Nov 11, 2013 12:33 am

Nerdlogger, thanks for the reply and writeup. I will try following your instructions and seeing where it gets me.
A couple questions first. Have you tried opening the stream and viewing it on a RPI and if it worked, how was the latency?

I saw that you said that you had a delay of 2-3 seconds with your webpage setup, so I'm wondering if you've tried to minimize latency somehow.

neilski
Posts: 2
Joined: Fri Nov 15, 2013 1:15 am

Re: Trouble streaming h264 video off a Logitech C920.

Fri Nov 15, 2013 1:53 am

I'm also very interested in latency for this kind of application - I can tolerate a few hundred milliseconds, and I can manage with fairly low resolution (e.g. VGA) which might help. 2-3 seconds would be unusable for me though...
If anyone has had success in streaming video through Ethernet/WiFi with lowish latency I'd love to hear about it.

dynamitemedia
Posts: 30
Joined: Sun Dec 01, 2013 9:12 pm

Re: Trouble streaming h264 video off a Logitech C920.

Mon Dec 02, 2013 3:10 am

i have gotten this working and not 100% concerned about latency but i can not get the choppy or ugly video out of it...

i have my camera in a powered hub and then use v4l2 to get it to use h264 but still choppy

i have checked with rpi-update and says it is the newest version and i am using the latest Raspbian of last week.

what is odd is that gucview gives me no issues with this choppy video only when i try with another program it seems like

fenix8k
Posts: 5
Joined: Thu Oct 04, 2012 6:56 pm

Re: Trouble streaming h264 video off a Logitech C920.

Wed Dec 04, 2013 12:46 am

Hi xD i m so noob on this xD but i get this worked with i think 50ms of delay xD yea really xD

what i do is use a Raspberry Pi camera module connect it to my PI, enbale it from the

Code: Select all

sudo ./raspi-config
reboot, then i downloaded in my PC Netcat and Mplayer all for windows i put them in the same folder for easy acces.

In my PI y run this command

Code: Select all

raspivid -t 0 -w 1024 -h 768 -o - | nc "IP destination" "PORT"

Code: Select all

raspivid -t 0 -w 1024 -h 768 -o - | nc 192.168.x.x 5001
Note: dont use the command -vf (vertical flip) it consume so mutch resources and with that i have 2 second delay

then in my windows PC, Run CMD.exe then go to your folder where u have nc and mplay with

Code: Select all

cd xfolder

Code: Select all

nc.exe -L -p 5001 | mplayer.exe -fps 31 -cache 256 -
You have to run fisrt the command on the windows Pc and then in the PI and work like a Charm! no delay nice video quality.

But i need somehow get this video feed into my controll interfase make in AS3.0 and Java any idea? xD

Return to “Graphics, sound and multimedia”