Difference between revisions of "Lisa Logitech Camera"
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
=Notes for getting Logitech QuickCam Pro for Notebooks camera | =Notes for getting camera streaming from Lisa over wifi= | ||
This page explains how to use a few applications to stream the video. | |||
Assumptions: | |||
* You already have a Logitech QuickCam Pro for Notebooks camera connected via USBH or USBOTG (only tested with hub) | |||
* The uvcvideo module is loaded and you have a /dev/video0 entry that works | |||
* You have a working wifi connection to a network | |||
==Gstreamer and uvc_stream== | ==Gstreamer and uvc_stream== | ||
These two applications are part of a single development effort and source is available so we're going to build... | |||
===Download source=== | ===Download source=== | ||
I grabbed svn on | I grabbed svn on 13:41, 27 August 2010 (CEST) | ||
svn co https://mjpg-streamer.svn.sourceforge.net/svnroot/mjpg-streamer mjpg-streamer | svn co https://mjpg-streamer.svn.sourceforge.net/svnroot/mjpg-streamer mjpg-streamer | ||
Line 11: | Line 20: | ||
===Build=== | ===Build=== | ||
Small changes required in Makefiles due to cross compilation for ARM architecture of overo (don't worry, painless) | Small changes required in : | ||
* Makefiles due to cross compilation for ARM architecture of overo (don't worry, painless) | |||
* some files that include a bogus header | |||
Skip below for patch (that may or may not apply clean) | |||
====Modify Makefiles==== | ====Modify Makefiles==== | ||
Line 113: | Line 126: | ||
TODO: opencv, libwebcam, mjpeg-client | TODO: opencv, libwebcam, mjpeg-client | ||
====ffserver/ffmpeg==== | |||
Create /etc/ffserver.conf with | |||
<pre> | |||
Port 8090 | |||
# bind to all IPs aliased or not | |||
BindAddress 0.0.0.0 | |||
# max number of simultaneous clients | |||
MaxClients 1000 | |||
# max bandwidth per-client (kb/s) | |||
MaxBandwidth 10000 | |||
# Suppress that if you want to launch ffserver as a daemon. | |||
NoDaemon | |||
<Feed feed1.ffm> | |||
File /tmp/feed1.ffm | |||
FileMaxSize 5M | |||
</Feed> | |||
# FLV output - good for streaming | |||
<Stream test.flv> | |||
# the source feed | |||
Feed feed1.ffm | |||
# the output stream format - FLV = FLash Video | |||
Format flv | |||
VideoCodec flv | |||
# this must match the ffmpeg -r argument | |||
VideoFrameRate 5 | |||
# generally leave this is a large number | |||
VideoBufferSize 80000 | |||
# another quality tweak | |||
VideoBitRate 200 | |||
# quality ranges - 1-31 (1 = best, 31 = worst) | |||
VideoQMin 1 | |||
VideoQMax 5 | |||
VideoSize 320x240 | |||
# this sets how many seconds in past to start | |||
PreRoll 0 | |||
# wecams don't have audio | |||
Noaudio | |||
</Stream> | |||
# ASF output - for windows media player | |||
<Stream test.asf> | |||
# the source feed | |||
Feed feed1.ffm | |||
# the output stream format - ASF | |||
Format asf | |||
VideoCodec msmpeg4 | |||
# this must match the ffmpeg -r argument | |||
VideoFrameRate 5 | |||
# generally leave this is a large number | |||
VideoBufferSize 80000 | |||
# another quality tweak | |||
VideoBitRate 200 | |||
# quality ranges - 1-31 (1 = best, 31 = worst) | |||
VideoQMin 1 | |||
VideoQMax 5 | |||
VideoSize 320x240 | |||
# this sets how many seconds in past to start | |||
PreRoll 0 | |||
# wecams don't have audio | |||
Noaudio | |||
</Stream> | |||
</pre> | |||
At one console start ffserver then at another launch ffmpeg with the following : | |||
: ffmpeg -r 15 -s 320x240 -f video4linux2 -i /dev/video0 http://localhost:8090/feed1.ffm | |||
In IE or VLC on a remote computer open URL : mms://<IP_ADDRESS>:8090/feed1.asf or mms://<IP_ADDRESS>:8090/feed1.flv | |||
ffmpeg -f video4linux2 -s 752x480 -r 15 -i /dev/video0 -f avi -vcodec copy -y filename2.avi | |||
==== VLC ==== | |||
This hasn't been done on overo yet. There's a recipe, but haven't compiled successfully yet.... | |||
on server run: | |||
vlc -I dummy -v --noaudio --ttl 12 v4l2:///dev/video0:width=640:height=480 --sout '#transcode{vcodec=mp4v,vb=800}:standard{access=http,mux=ogg,url=bill.recherche.enac.fr:8080}' | |||
client: | |||
cvlc http://bill:8080 | |||
===Other recommendations : === | |||
<pre> | |||
Streaming | |||
^^^^^^^^^^ | |||
1. Mplayer | |||
Through serial console: | |||
mplayer tv:// -tv driver=v4l2:device=/dev/video0:width=480:height=272 -vo fbdev -v -brightness 0 -contrast 0 -saturation 0 | |||
Using xterm: | |||
mplayer tv:// -tv driver=v4l2:device=/dev/video0:width=320:height=240 | |||
2. Gstreamer | |||
gst-launch -v v4l2src ! 'video/x-raw-yuv,format=(fourcc)UYVY,width=320,height=240,framerate=(fraction)15/1' ! fakesink | |||
3. Mjpeg-streamer | |||
mjpg_streamer -i "input_uvc.so -f 30 -r 640x480 -y -d /dev/video0" -o "output_http.so -p 8090 -w www" | |||
Recording | |||
^^^^^^^^^^ | |||
1. Menucoder | |||
mencoder tv:// -tv driver=v4l2:width=480:height=272:device=/dev/video0 -nosound -fps 10 -ovc lavc -o filename.avi | |||
2. FFMPEG | |||
ffmpeg -f video4linux2 -s 320x240 -r 30000/1001 -i /dev/video0 -f avi -vcodec mjpeg -s 320x240 -r 30000/1001 -y filename.avi | |||
</pre> | |||
==Notes== | |||
* bill is the name of my laptop on the network | |||
* auto3 is the name of the overo device on the network | |||
* overo-oe installation directories change so absolute paths in patch and on this page are sure to break at some point, use as reference :-) | |||
[[Category:Hardware]] [[Category:Software]] [[Category:User_Documentation]] |
Latest revision as of 08:12, 18 April 2011
Notes for getting camera streaming from Lisa over wifi
This page explains how to use a few applications to stream the video.
Assumptions:
- You already have a Logitech QuickCam Pro for Notebooks camera connected via USBH or USBOTG (only tested with hub)
- The uvcvideo module is loaded and you have a /dev/video0 entry that works
- You have a working wifi connection to a network
Gstreamer and uvc_stream
These two applications are part of a single development effort and source is available so we're going to build...
Download source
I grabbed svn on 13:41, 27 August 2010 (CEST)
svn co https://mjpg-streamer.svn.sourceforge.net/svnroot/mjpg-streamer mjpg-streamer
Build
Small changes required in :
- Makefiles due to cross compilation for ARM architecture of overo (don't worry, painless)
- some files that include a bogus header
Skip below for patch (that may or may not apply clean)
Modify Makefiles
In mjpg-streamer/Makefile and uvc-streamer/Makefile I put:
DESTDIR = /home/paul # set the compiler to use #CC = gcc OVERO_OE=/home/paul/overo-oe CC = $(OVERO_OE)/tmp/cross/armv7a/bin/arm-angstrom-linux-gnueabi-gcc CROSS_COMPILE=$(OVERO_OE)/tmp/cross/armv7a/bin/arm-angstrom-linux-gnueabi- ARCH=arm GLIB_INC = $(OVERO_OE)/tmp/work/armv7a-angstrom-linux-gnueabi/glib-2.0-2.22.4-r1/staging-pkg/staging/armv7a-angstrom-linux-gnueabi/usr/include/glib-2.0 GLIB_LIB = $(OVERO_OE)/tmp/work/armv7a-angstrom-linux-gnueabi/glib-2.0-2.22.4-r1/staging-pkg/staging/armv7a-angstrom-linux-gnueabi/usr/lib/
I also had to do this in all the Makefiles in the plugins folder
Remove header
apparently libv4l2.h which is included in a few files is no longer included. Thankfully it doesn't appear to be needed so commenting the references works ok :
paul@paul-laptop:/media/PackBell_Linux/overo-oe/mjpg-streamer/mjpg-streamer$ find . | xargs grep -n "libv4l2.h" ./plugins/output_http/httpd.c:40://#include <libv4l2.h> ./plugins/output_http/.svn/text-base/httpd.c.svn-base:40:#include <libv4l2.h> ./plugins/input_uvc/v4l2uvc.h:35://#include <libv4l2.h> ./plugins/input_uvc/.svn/text-base/v4l2uvc.h.svn-base:35:#include <libv4l2.h>
patch available here
Build uvc_streamer
paul@paul-laptop:/media/PackBell_Linux/overo-oe/mjpg-streamer/uvc-streamer$ make
Build mjpg-streamer
paul@paul-laptop:/media/PackBell_Linux/overo-oe/mjpg-streamer/mjpg-streamer$ make
copy to target
scp uvc_stream @auto3: scp *.so start.sh mjpg_streamer @auto3:mjpg-streamer scp -r www @auto3:mjpg-streamer
start streaming
Log in
- ssh auto3
Look around :
- root@overo:/home/paul# ls
- capture.elf ffserver.conf mjpg-streamer overo_twist.elf uvc_stream
Go for it:
root@overo:/home/paul# ./uvc_stream Using V4L2 device.....: /dev/video0 Resolution............: 640 x 480 frames per second.....: 5 TCP port..............: 8080 motor control TCP port: 8081 root@overo:/home/paul# cd mjpg-streamer/ root@overo:/home/paul/mjpg-streamer# ./start.sh MJPG Streamer Version.: 2.0 i: Using V4L2 device.: /dev/video0 i: Desired Resolution: 640 x 480 i: Frames Per Second.: 5 i: Format............: MJPEG o: www-folder-path...: ./www/ o: HTTP TCP port.....: 8080 o: username:password.: disabled o: commands..........: enabled
watch stream
In chrome or vlc open http://auto3:8080
uvc_stream
mjpg_streamer
Coming soon
ffmpeg, mplayer, mencoder, vlc, gstreamer. what was library needed libav? installing with opkg "opkg install <name>", proxy setup in /etc/opkg/opkg.conf setting up x-forwarding over ssh tunnel?
TODO: opencv, libwebcam, mjpeg-client
ffserver/ffmpeg
Create /etc/ffserver.conf with
Port 8090 # bind to all IPs aliased or not BindAddress 0.0.0.0 # max number of simultaneous clients MaxClients 1000 # max bandwidth per-client (kb/s) MaxBandwidth 10000 # Suppress that if you want to launch ffserver as a daemon. NoDaemon <Feed feed1.ffm> File /tmp/feed1.ffm FileMaxSize 5M </Feed> # FLV output - good for streaming <Stream test.flv> # the source feed Feed feed1.ffm # the output stream format - FLV = FLash Video Format flv VideoCodec flv # this must match the ffmpeg -r argument VideoFrameRate 5 # generally leave this is a large number VideoBufferSize 80000 # another quality tweak VideoBitRate 200 # quality ranges - 1-31 (1 = best, 31 = worst) VideoQMin 1 VideoQMax 5 VideoSize 320x240 # this sets how many seconds in past to start PreRoll 0 # wecams don't have audio Noaudio </Stream> # ASF output - for windows media player <Stream test.asf> # the source feed Feed feed1.ffm # the output stream format - ASF Format asf VideoCodec msmpeg4 # this must match the ffmpeg -r argument VideoFrameRate 5 # generally leave this is a large number VideoBufferSize 80000 # another quality tweak VideoBitRate 200 # quality ranges - 1-31 (1 = best, 31 = worst) VideoQMin 1 VideoQMax 5 VideoSize 320x240 # this sets how many seconds in past to start PreRoll 0 # wecams don't have audio Noaudio </Stream>
At one console start ffserver then at another launch ffmpeg with the following :
- ffmpeg -r 15 -s 320x240 -f video4linux2 -i /dev/video0 http://localhost:8090/feed1.ffm
In IE or VLC on a remote computer open URL : mms://<IP_ADDRESS>:8090/feed1.asf or mms://<IP_ADDRESS>:8090/feed1.flv
ffmpeg -f video4linux2 -s 752x480 -r 15 -i /dev/video0 -f avi -vcodec copy -y filename2.avi
VLC
This hasn't been done on overo yet. There's a recipe, but haven't compiled successfully yet....
on server run:
vlc -I dummy -v --noaudio --ttl 12 v4l2:///dev/video0:width=640:height=480 --sout '#transcode{vcodec=mp4v,vb=800}:standard{access=http,mux=ogg,url=bill.recherche.enac.fr:8080}'
client:
cvlc http://bill:8080
Other recommendations :
Streaming ^^^^^^^^^^ 1. Mplayer Through serial console: mplayer tv:// -tv driver=v4l2:device=/dev/video0:width=480:height=272 -vo fbdev -v -brightness 0 -contrast 0 -saturation 0 Using xterm: mplayer tv:// -tv driver=v4l2:device=/dev/video0:width=320:height=240 2. Gstreamer gst-launch -v v4l2src ! 'video/x-raw-yuv,format=(fourcc)UYVY,width=320,height=240,framerate=(fraction)15/1' ! fakesink 3. Mjpeg-streamer mjpg_streamer -i "input_uvc.so -f 30 -r 640x480 -y -d /dev/video0" -o "output_http.so -p 8090 -w www" Recording ^^^^^^^^^^ 1. Menucoder mencoder tv:// -tv driver=v4l2:width=480:height=272:device=/dev/video0 -nosound -fps 10 -ovc lavc -o filename.avi 2. FFMPEG ffmpeg -f video4linux2 -s 320x240 -r 30000/1001 -i /dev/video0 -f avi -vcodec mjpeg -s 320x240 -r 30000/1001 -y filename.avi
Notes
- bill is the name of my laptop on the network
- auto3 is the name of the overo device on the network
- overo-oe installation directories change so absolute paths in patch and on this page are sure to break at some point, use as reference :-)