Feed on Posts or Comments

Monthly ArchiveMay 2007




Internet & Fun & Tech & Programming Daantje on 11 May 2007

GURU!

Get lost in this site! This is realy cool for every hardware and web developer! This guy makes cool stuff! The site is dhtml and not flash! I repeat, not flash! I did somthing of the same stuff on this site.

Linux & Tech & Programming Daantje on 07 May 2007

Convert Axis webcam stream to Flash (.swf/.flv)

Revised version: Tue March 10, 2009
We use an Axis 206w and a 207w webcam at work. This camera has an build in webserver that serves an MJPEG (Motion JPEG video) stream. Later cams servers also MPEG4 streams, but the 206w doesn’t. It has an buildin .swf feed, but that one does not work on my browsers. Now I have a work around to use swf files. What I do is using FFmpeg to convert the MJPEG feed to swf and flv. I use a separate server, not the build in one on the cam!

(Just for explanation; 10.0.0.1 is my server and 10.0.0.106 is my camera)

What I did to make it all work… Installed the latest ffmpeg. (Downloaded the source, compiled it (./configure;make;make install;) Or on Debian Lenny I used the ‘unstable’ packages. (FFmpeg version 0.5-svn17737+3:0.svn20090303-1) I’ve tried older versions, even the ’stable’ Lenny version, but the swf would not load every time in my browsers. So when you have a good ffmpeg and ffserver, then comes the real trick… Configure your ffserver. Edit /etc/ffserver.conf , use this source:

# Port on which the server is listening. You must select a different
# port from your standard HTTP web server if it is running on the same
# computer.
Port 8090

# Address on which the server is bound. Only useful if you have
# several network interfaces.
BindAddress 0.0.0.0

# Number of simultaneous HTTP connections that can be handled. It has
# to be defined *before* the MaxClients parameter, since it defines the
# MaxClients maximum limit.
MaxHTTPConnections 2000

# Number of simultaneous requests that can be handled. Since FFServer
# is very fast, it is more likely that you will want to leave this high
# and use MaxBandwidth, below.
MaxClients 1000

# This the maximum amount of kbit/sec that you are prepared to
# consume when streaming to clients.
MaxBandwidth 1000

# Access log file (uses standard Apache log file format)
# '-' is the standard output.
CustomLog -

# Suppress that if you want to launch ffserver as a daemon.
NoDaemon

<Feed feed1.ffm>
	File /tmp/feed1.ffm #when remarked, no file is beeing created and the stream keeps working!!
	FileMaxSize 200K
       # Only allow connections from localhost to the feed.
       ACL allow 127.0.0.1
</Feed>

# SWF output - great for testing
<Stream test.swf>
	# the source feed
	Feed feed1.ffm
	# the output stream format - SWF = flash
	Format swf
	# this must match the ffmpeg -r argument
	VideoFrameRate 5
	# another quality tweak
	VideoBitRate 320
	# quality ranges - 1-31 (1 = best, 31 = worst)
	VideoQMin 1
	VideoQMax 3
	VideoSize 640x480
	# wecams don't have audio
	NoAudio
</Stream>

# 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
	# another quality tweak
	VideoBitRate 320
	# quality ranges - 1-31 (1 = best, 31 = worst)
	VideoQMin 1
	VideoQMax 3
	VideoSize 640x480
	# wecams don't have audio
	NoAudio
</Stream>

<Stream stat.html>
	Format status
</Stream>

<Redirect index.html>
	# credits!
	URL http://ffmpeg.sourceforge.net/
</Redirect>

Now your done with your ffserver configuration. Now make a little shell script to start your converter. It uses cCurl Wget to get the stream from the camera. But it could also be done with a php or perl script that opens a socket and parses the content to stout. Curl does that real fast, so I use that. Curl breaks some frames, I use wget now. I’ve made some crude scripts to keep the server up, even when something goes down. I’ve noticed that the server sometimes stops without warning. That is the reason I don’t use the ffserver in daemon mode. Also change the port 8090 when you have some other service running on that port, like OpenERP… (That was my first mistake ;)

Make a file called ’stream.sh’ and put the following source in:

#!/bin/bash
while [ 1 ]
do
wget -nv -O - http://10.0.0.106/axis-cgi/mjpg/video.cgi |
   ffmpeg -er 4 -y -r 5 -f mjpeg -i - http://127.0.0.1:8090/feed1.ffm
done

You can change http://10.0.0.106/axis-cgi/mjpg/video.cgi?resolution=320×240 to your own URL.

Now create a file server.sh and put this in:

#!/bin/bash
while [ 1 ]
do
  ffserver
done

Now change the mod of the scripts so you can start them…

chmod +x stream.sh server.sh

And now your done, just start the the script with nohup so the process keeps running after you close your terminal…

nohup ./server.sh > /dev/null &
nohup ./start.sh > /dev/null &

If you don’t use nohup, the converter parses all messages to stout. Easy for debugging ;)
Now just point your browser to your ffserver :

http://10.0.0.1:8090/test.swf

And it should work! Open a bottle of beer!
Here’s our webcam, viewing Alkmaardermeer, Akersloot, the Neterlands.

chopper & bicycles & Fun & Personal Daantje on 04 May 2007

My other bikes…

Finaly I have some pictures of me and my daughter and my bikes.. The black bike is an stretched cruiser, the Project 346 Basman Classic. Only the wheels are custom on this photo. Back an 24″ inch with a Nirve Fatass tire on it and a Schram 3 speed. The front wheel is 26″ inch with a Nirve tire on it. I’m customizing it, will post pictures later.
The blue bike is an 8ball Limousine, but chopped (check the link for its original form!), longer Nirve chopper fork, 24″ inch Rigida (80) rim with an Nirve Fatass tire and a Nexus 3 speed on the back and a 26″ inch front wheel. And of course the small ape hanger. The bike is from front till end 2.72 meters long. The steering handles very bad with the fork in this angle! These pictures are taken with my Chariot. Now the length of the complete thing is absurd! But it’s really fun to ride it!

bij-daan-voorop.jpg

achter-de-fiets-1.jpg

achter-de-fiets-2.jpg