Raspberry video streaming server for keychain 808 with ffmpeg

Image showing Raspberry pi streaming from an 808 keychain 6pounds camera

Hi there,

I’m writing down some notes about

installing, configuring, testing an 808 Keychain Webcam #3

even if i think it can be appliable to several different models (if they can actually act as webcam).

So, you just learned that your Keychain 808 Keychain Camera can be used as Webcam, and I have to say, I just plugged it into a Windows XP machine, switched into Webcam mode and it immediately appeared into “My PC” as Webcam, images were of good quality and also the frame rate was decent. (Please note: usage of “good quality” is reported to the price, i would never compare this device with better products as GoPro or reflex cameras: this is a 6,00 £ device.)

How to configure 808 keychain camera (or any other) with wheezy running on a Raspberryπ?

Simple: connect your device to the USB port, then let it being recognized as external drive (this is what append when you plug the Keychain to the USB port), once it has appeared into “My PC”, click once the Camera power button, just for a while, no long click, and you will see the external storage device disappearing from “My PC”. Now, if your PC/operating system can recognize the camera without drivers (windows) you are lucky, instead with Mac Os X Lion it does not work (but if it works in Linux Debian / Raspbian, probably will work on Os X too, I will investigate this point later).

Now go back to our Raspberry PI Debian headless video server with the duty to stream over the internet so what we do is to use the raspian bootfile for configure memory splitting in order to give the max amount of memory to the system instead of the video card (obviously here we are using raspberry with no desktop environment, just ssh). Otherwise if you have a desktop environment, or just if you are happy with your config, do not do nothing, this guide will work independently from graphical desktop environment.


if root

root@raspberrypi:/boot# cp arm224_start.elf start.elf

This will increase the memory amount available to the system, reducing video memory to minimum (16 Mb).

if you are not root prepend “sudo” to each command.
Then reboot.

at reboot again become root (or remember sudo) and type:

root@raspberrypi:/boot# apt-get update && apt-get upgrade

Note: The “&&” within this line, is used to concatenate two commands in order to execute the second one, if and after the first completes with no errors. It can be used several time per line. Usually I do this in order to let the machine work while I do something else: some tasks as compiling can require a lot of time especially on small CPU like this one).

It may take some time…

At the end of the process install hwinfo in order to discover as much information as possible on your webcam and modules needed to use it.

so, type:

root@raspberrypi:/boot# apt-get install hwinfo

once installed, type

root@raspberrypi:/boot# hwinfo --usb

you should see several rows of output, search by excluding keyboard, usb hub, usb ethernet: in our case search for something like the following

04: USB 00.0: 0000 Unclassified device
  [Created at usb.122]
  Unique ID: dwDZ.fh_238dBrkB
  Parent ID: ADDn.GVovileGj8F
  SysFS ID: /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0
  SysFS BusID: 1-1.3:1.0
  Hardware Class: unknown
  Model: "Generic USB2.0 Device"
  Hotplug: USB
  Vendor: usb 0x1908 "Generic"
  Device: usb 0x3251 "USB2.0 Device"
  Revision: "1.00"
  Serial ID: "20110616010203"
  Driver: "uvcvideo"
  Driver Modules: "uvcvideo"
  Device File: /dev/input/event0
  Device Files: /dev/input/event0, /dev/input/by-id/usb-Generic_USB2.0_Device_20110616010203-event-if00, /dev/input/by-path/platform-bcm2708_usb-usb-0:1.3:1.0-event
  Device Number: char 13:64
  Speed: 480 Mbps
  Module Alias: "usb:v1908p3251d0100dcEFdsc02dp01ic0Eisc01ip00in00"
  Driver Info #0:
    Driver Status: uvcvideo is active
    Driver Activation Cmd: "modprobe uvcvideo"
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #9 (Hub)

then you have to install and load the correct driver by typing:

sudo modprobe uvcvideo

Or in other cases:

sudo modprobe gspca_zc3xx

Now, normaly we would install a webcam viewer software but, for my experience, it is frustrating, because (maybe it’s my fault, but) it’s veeeeeery slow. Deadly.
So far we should have succesfully configured the webcam even if we don’t have an actual method to test it, that’s why letìs go straight to the next step:

In order to install ffmpeg we need to download it first, so:
Add the following lines into /etc/apt/sources.list

deb-src http://www.deb-multimedia.org sid main
deb http://www.deb-multimedia.org wheezy main non-free

Comment: I can’t remember why the first line is pointing to the sid repository while the second instead, is pointing to wheezy. For this reason I’m doing this procedure again, but using this time both wheezy repositories. And i will update this post as soon as I figure out this detail.

then run

apt-get install deb-multimedia-keyring
apt-get update

Remove or comment the second line from /etc/apt/sources.list

#deb http://www.deb-multimedia.org wheezy main non-free

then run:

apt-get source ffmpeg-dmo

Check for the actual version and go into the newly created dir:

cd ffmpeg-dmo-0.11


Now (2013-01-15) is:

cd ffmpeg-dmo-1.0.1

then run

./configure --enable-filter=movie --enable-avfilter
sudo make install

If you concatenate the commands together and use them as root, you have enough time to get a coffee…outside.
Concatenated commands (if you used the three commands before you don’t need to do this!)

./configure --enable-filter=movie --enable-avfilter && make && make install

Sudo is needed if you are NOT root already.
We need to create a configuration file for ffserver, we will place it in /etc/ and call it ffserver.conf

The content of this file will be as follows:

Port 80
MaxClients 10
MaxBandwidth 50000
CustomLog -
<Feed feed1.ffm>
file /tmp/webcam.ffm
FileMaxSize 10M
#We are going to use flash format (sorry internet explorer and iphone/pad/pod/whatever)
<Stream test.swf>
Feed feed1.ffm
Format swf
VideoFrameRate 4
VideoSize 320x240
VideoBitRate 64
VideoBufferSize 10
VideoQMin 6
VideoQMax 31

<Stream stat.html>
Format status
# Only allow local people to get the status
ACL allow localhost
ACL allow
#FaviconURL https://blog.giuseppeurso.net/favicon.ico

# Redirect index.html to the appropriate site

<Redirect index.html>
URL https://blog.giuseppeurso.net/

Please, note the port 80 is in use, you can change it for a more convenient port if, 8080 for example, you already have a webserver instance running listening on that port.
Although the producer claims a resolution of 720, i know for sure it is interpolated by the poor chip of the camera, degradating the resulting quality. That’s why you will have better results if you use a resolution as close as possible with the camera native resolution.
Also, keep in mind that this parameter and the framerate & bitrate values can determine a bad quality stream.

Now it’s time to start ffserver with the command

ffserver -f /etc/ffserver.conf &

executed as root: this will start ffserver and send it in background.

Then we need to start capturing the video with ffmpeg and transmit the feed to ffserver with the configured path

ffmpeg -v verbose -r 10 -s 352x240 -f video4linux2 -i /dev/video0 http://localhost/feed1.ffm &

You are advised to save this command into an .sh shell script file , chmod +x and then you can use a single word command to star streaming or, better, you can do a startup script for this task.

An ideal startup shell script would do:

killall ffserver
killall ffmpeg
ffserver -f /etc/ffserver.conf
ffmpeg -v verbose -r 10 -s 352x240 -f video4linux2 -i /dev/video0 http://localhost/feed1.ffm &

Last step:
Point your browser to the Raspberry IP address specifying protocol and port as follows:




I used the 8080 port to demonstrate how to leave the 80/tcp free for the webserver.

Hope this helped!

Incoming search terms:

  • www canlıvebcam org (13)
(Visited 9,019 times, 1 visits today)

Author: Giuseppe Urso

Giuseppe lives in Haarlem now with his shiny dog, Filippa In 1982 received his first home computer, a Commodore 64, followed by Datasette and a 1541 Floppy Disk Drive. In 1999 he installed his first Linux distro (LRH6). In 2006 he switched to Debian as favourite OS. Giuseppe Urso actively sustains the Free Software Fundation and his founder Richard Mattew Stallman, he speaks to people trying to convince them to join the fight now, and about how important is to use Free Software only. He has a job as Infra Specialist at Hippo Enterprise Java Cms an Open Source Enterprise class Content Management System, one of the coolest company ever, in Amsterdam. He's always ready to install Debian on other people computers for free.

2 thoughts on “Raspberry video streaming server for keychain 808 with ffmpeg”

  1. Hi, sorry if this seems foolish quesiton: so you eventually had this 808 keychain camera work on your Raspberry working without problem as a streaming web camera please?

    1. The only problem is that you have to set it in let’s say “camera mode” right after powering it up, otherwise it will work as external usb drive. If I’m not wrong it’s about log pressing one of the two buttons after connecting the usb.

      Hope this helps

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.