Posted: December 2006
Naken Web is both a tiny web server capable of serving static web pages with built in ability to serve out live and prerecorded video in MJPEG format from capture devices such as webcams and AVI files. Naken Web is small enough (22k to 32k) to run on embedded platforms and has been tested on the Gumstix embedded computer, a Linksys WRT54GL router running OpenWrt, and a Neuros OSD. Naken Web can be configured to serve out video from URLs similar to commercial IP cameras like Axis.
I also have a sample plugin for Naken Web that shows it doing motor control similar to what a commercial PTZ IP camera would have here: http://www.mikekohn.net/micro/atmel_motor_control.php. I'm using it to control the motors on a Linksys Helicopter.
July 26, 2008 - Fixed a bug that caused plugins to not work :(. I have a video on YouTube of Naken Web being used on a Linksys router to communicate with an Atmel ATmega168 to control a servo motor here: http://www.youtube.com/watch?v=0KdkPXHDsVw.
July 23, 2008 - I started working on a module for this web server that can do motor control on an embedded computer, much the way Axis has their PTZ control. I have a project page here for anyone interested: atmel_motor_control.php.
February 27, 2008 - I added binaries for the Atmel's avr32. It's compiled for their network gateway demo board which I hope to use to interface over rs232 with an Atmel ATmega168 microcontroller using Naken Web as human interface. I'll post more info as this project continues.
July 18, 2007 - I have the server working with a Logitech Pro 5000 now using the Linux uvc driver. There is also a new plugin interface with a simple example. The plugin allows the server to alias a URL to a function inside a shared object library. Could be useful for interfacing another program to a web frontend without a CGI. So far only the GET method works.
A couple years ago I modified my Naken Chat chat server so that would act like a web server and serve out JPEG images out of an AVI file. Pressing the refresh button on a web browser to grab a new image would display the next image in the video based on the time that the web server was started. In other words, the video would play at normal speed in the browser. If you wait 5 seconds before pressing refresh and the avi plays at 30 frames a second, 150 frames are skipped so the time in the video is always accurate.
Anyway, I recently started up development of this program again and
it currently has the following features:
If you downloaded the source code instead of the binaries,
you can build it by typing:
Starting with the January 02, 2007 version, I added a --with-mmap option. This will force Naken Web to mmap() (or on Windows, map a file) the avi videos to try and reduce i/o loads. I haven't had a chance to test this yet under a loaded system, but I'm thinking it will reduce the i/o significantly on computers with harddrives. It probably won't be a good thing to do embedded systems, but I haven't had a chance to test it yet.
Basically, you can define up to 100 avi videos in the nakenweb.conf file. They are defined with the filename option and are numbered in order they are put in the file. The first defined AVI is video #0, the second is video #1, etc. After defining videos, maxconn is set to the max number of webclients that can connect to the server at one time. max_idle_time is set to how long a client can be connected to the server without sending any data before being booted. port tells the server which port to bind to. If you have no other web server, you'll probably want to set this to 80.
An example nakenweb.conf file could look like this:
To start the server type:
./nakenweb -f nakenweb.conf
This will start the server using nakenwebcam.conf as the configuration file. If you want more help with compiling or starting the server, you can read the documentation for Naken Chat. The docs there should be very similar, if not the same.
After the sever is started, you can test connecting to the server by typing: http://localhost/0 into your webbrowser. This should give you the current video frame from blah.avi. Alternatively you could type: http://localhost/1 to get the current frame from the testing.avi or http://localhost/2 to get the current frame from asdf.avi. By refreshing the webbrowser, the newest frame will show up. It'd be pretty easy to write a web client that constantly grabs the newest frames from the videos to create full motion video.
IP Camera Emulation Configuration
Setting up an alias for an IP camera should be fairly straight
forward. The following 2 examples will set up a couple of aliases
VAPIX API format:
You are not limited to the number of aliases you can create, altho for each one you define a few bytes of memory will be allocated and a tiny amount of CPU is used to check if the current URL matches the alias for every hit to the server. If this doesn't make sense, send me an email. I'd be glad to help :)
To set up a Video4Linux2 device, the capture
parameter is used:
If you'd like to serve out AVI files the AVI's need to use the MJPEG codec. If you have a video encoded with mpeg or some other fileformat/codec, you can convert it to AVI/MJPEG using ffmpeg with the following line:
ffmpeg -i myvideo.mpeg -vcodec mjpeg -b 10000 -s 352x240 -an out.avi
Obviously you need to change myvideo.mpeg to the name of your input file, out.avi to what you want the output file to be called, -b is the bitrate and will affect the size of each jpeg in the avi file along with the quality of the video. The -s option is the resolution of the video. The -an option tells ffmpeg to leave out audio.
New Features (March 2007)
The following features are implemented in the new version:
The following are my list of things to work on:
License: Since Naken Chat is GPL, this program is GPL also.
Note: CGI is currently compiled out of these binaries
If you need binaries for another system please email me
Java Webcam Viewer (Will be improved later)
I have a J2ME IpCamView here: http://www.mikekohn.net/j2me.php
Copyright 1997-2020 - Michael Kohn