Linux & Tech & Programming Daantje on 07 May 2007 05:16 pm
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.
85 Responses to “Convert Axis webcam stream to Flash (.swf/.flv)”
Leave a Reply
You must be logged in to post a comment.
on 30 May 2007 at 3:50 pm 1.James H said …
Hi there,
We tried this out and it looks like it works for the most part. The only issue we\’ve found so far is that the video quality is not that great (a little snowy). Are there settings, etc. we should look at in particular to ensure good quality.
Thanks, James
on 07 Jun 2007 at 2:17 pm 2.B. Smith said …
What am i doing wrong.
./start.sh
/etc/ffserver.conf:42: Incorrect keyword: ‘VideoCodev’
Incorrect config file - exiting.
FFmpeg version SVN-r9235, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration:
libavutil version: 49.4.0
libavcodec version: 51.40.4
libavformat version: 51.12.1
built on Jun 7 2007 08:44:07, gcc: 4.1.1 20070105 (Red Hat 4.1.1-51)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 15743 0 15743 0 0 8108 0 –:–:– 0:00:01 –:–:– 12049Input #0, mjpeg, from ‘pipe:’:
Duration: N/A, bitrate: N/A
Stream #0.0: Video: mjpeg, yuvj422p, 320×240, 4.00 fps(r)
Could not read stream parameters from ‘http://localhost:8090/feed1.ffm’
on 07 Jun 2007 at 2:45 pm 3.Daantje said …
VideoCodev == VideoCodec ??
VideoCodec flv
(my fault, fixed it…)
on 07 Jun 2007 at 9:43 pm 4.B. Smith said …
Why does it make a massive ffm File?
i have to stop it to get it to stream …
from http://myip:8090/test.swf
it will not encode and stream at the same time
…
on 08 Jun 2007 at 11:30 am 5.Daantje said …
this will fix that:
curl http://10.0.0.106/axis-cgi/mjpg/video.cgi?resolution=640×480 | ffmpeg -er 4 -y -v quiet -an -f mjpeg -r 4 -i - http://localhost:8090/feed1.ffm;
I’ve changed the documentation too…
on 08 Jun 2007 at 12:25 pm 6.B. Smith said …
Still the same problem.
i wood like to get this to work as it will solve a lot of problems. for me.. Thank you for your help so far..
on 08 Jun 2007 at 12:40 pm 7.Daantje said …
is ffserver running? do you have something in your logs?
on 08 Jun 2007 at 12:58 pm 8.Daantje said …
It looks like your ffmpeg is not pushing to the feed?!
if you add the following line to your ffserver.conf
CustomLog /var/log/ffserver
You can see what the server is doing.
And check what you have if you do the ffmpeg conversion command direct on the command line, without running it through a shell script. The ffmpeg should parse to the screen, and give you the info you’ll need to fix it.
Could not read stream parameters from ‘http://localhost:8090/feed1.ffm’
Looks like your ffserver is not running…. Or not accepting connections on 8090.
on 09 Jun 2007 at 1:27 am 9.B. Smith said …
Still buffers in to a Big File.
# cat /var/log/ffserver
127.0.0.1 - - [Fri Jun 8 16:55:01 2007] \\
on 09 Jun 2007 at 8:55 am 10.Daantje said …
how is the file called? is the ffmpeg command one line?!
curl http://10.0.0.106/axis-cgi/mjpg/video.cgi?resolution=640×480 | ffmpeg -er 4 -y -v quiet -an -f mjpeg -r 4 -i - http://localhost:8090/feed1.ffm;
on 20 Jul 2007 at 3:33 am 11.José Antonio Caso said …
I\’m getting this output
curl: (23) Failed writing body
I don\’t know why is this happening… if I use curl as a separte command, I can see the stout of the stream, but I can\’t make the ffmpeg to work along with it.
on 20 Jul 2007 at 3:30 pm 12.Daantje said …
is the curl and ffmpeg piped commands ONE line?!
on 21 Jul 2007 at 1:40 am 13.José Antonio Caso said …
Daantje, thank you for your post.
Yes, I just double checked that curl and ffmpeg are piped in the same line.
Maybe I\’m using an outdated version of curl and ffmpeg (I\’m using Ubuntu 6.06 LTS packages downloaded with Synaptic).
This is my output:
caso@caso-desktop:~$ ./start.sh
ffmpeg version CVS, build 3276800, Copyright (c) 2000-2004 Fabrice Bellard
configuration: –extra-cflags=-fomit-frame-pointer -DRUNTIME_CPUDETECT –build i486-linux-gnu –enable-gpl –enable-pp –enable-zlib –enable-vorbis –enable-libogg –enable-theora –enable-a52 –enable-dts –enable-dc1394 –enable-libgsm –disable-debug –prefix=/usr
built on Oct 4 2006 10:57:36, gcc: 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1263 0 1263 0 0 10205 0 –:–:– –:–:– –:–:– 10205Stream mapping:
Stream #0.0 -> #0.0
100 105k 0 105k 0 0 84307 0 –:–:– 0:00:01 –:–:– 92288
curl: (23) Failed writing body
./start.sh: line 2: 5599 Exit 23 curl http://192.168.1.29/axis-cgi/mjpg/video.cgi?resolution=640×480
5600 Segmentation failure | ffmpeg -er 4 -y -v quiet -an -f mjpeg -r 4 -i - http://localhost:8090/feed1.ffm
Thanks in advance
on 21 Jul 2007 at 9:56 am 14.Daantje said …
Hmmm that looks like your ffmpeg is broken. It gives a Segmentation failure. Try to recompile it from the latest source.
on 24 Jul 2007 at 9:10 am 15.Proschuto said …
I am having trouble with this on Ubuntu 7.04 (Feisty Fawn).
# curl http://192.168.0.100/axis-cgi/mjpg/video.cgi?resolution=640×480 | ffmpeg -er 4 -y -v quiet -an -f mjpeg -r 4 -i - http://localhost:8090/feed1.ffm;
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
configuration: –enable-gpl –enable-pp –enable-pthreads –enable-vorbis –enable-libogg –enable-a52 –enable-dts –enable-libgsm –enable-dc1394 –disable-debug –enable-mp3lame –enable-faadbin –enable-faad –enable-faac –enable-xvid –enable-x264 –enable-amr_nb –enable-amr_wb –enable-shared –prefix=/usr
libavutil version: 0d.49.0.0
libavcodec version: 0d.51.11.0
libavformat version: 0d.50.5.0
built on Mar 21 2007 14:14:05, gcc: 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 14638 0 14638 0 0 57700 0 –:–:– –:–:– –:–:– 233k
Could not find input stream matching output stream #0.0
on 25 Jul 2007 at 5:48 pm 16.José Antonio Caso said …
Thank you Daantje, do not use the Ubuntu\’s Synaptic version, as it might not work.
I checked out from the SVN and compiled correctly. So please, Ubuntu users (Proschuto included), compile from source and it\’ll work.
Proschuto, have you tried setting the camera on anounymous view?
on 26 Jul 2007 at 9:03 pm 17.Jean-Marc Paratte said …
More simple…
Use the built-in SWF module of AXIS206 rev.2
with a command like:
http://user:password@server:port/axis-cgi/mjpg/video.swf?resolution=320×240
This command works fine with Firefox 2.
Works fine with Macromedia Flash Player 7 but without user:password@ (anonymous viewing access only).
Don\’t work with IE7, first because IE don\’t accept the user:password@, second due to miscellenaous javascript error - SWF object embedded in OBJECT & SCRIPT.
Jean-Marc
on 26 Jul 2007 at 9:13 pm 18.Daantje said …
That didn’t work for me… Even in anonymous mode, I get an empty swf, just white running movie. I have the latest firmware.
on 26 Jul 2007 at 9:27 pm 19.Jean-Marc Paratte said …
Check this URL:
http://rms-serveur.milking.ch:8081/axis-cgi/mjpg/video.swf?resolution=320×240
Anonymous access for a couple of hours.
on 26 Jul 2007 at 10:00 pm 20.Daantje said …
Yes I know, but try to embed it into a HTML page with embed and objectt tags… And it stops working… At least my version does
on 22 Aug 2007 at 3:23 pm 21.GP said …
Hello,
Wich player do you use to read de flv stream ?
Thanks.
on 22 Aug 2007 at 9:39 pm 22.Daantje said …
????? I think it’s Flash…
What do you mean? Why else create a FLV stream??
on 18 Sep 2007 at 6:01 am 23.Ivan said …
Hi,
I\’ve got it all set up and I get a live stream from the test.swf, but I can\’t get flash to stream the test.flv, it just keeps loading the file and displays the first frame.
Has anyone figured out a way around this, or a know of a pre-compiled player that will play it, i\’ve tried FlowPlayer and jeroenwijering\’s FLV Player neither of them will play it.
??
Thanks,
Ivan
on 25 Sep 2007 at 7:14 pm 24.Gustavo Felisberto said …
I\’m having some issues:
curl http://10.2.50.160:8081/ | ffmpeg -er 4 -y -an -f mjpeg -r 4 -i - http://localhost:8090/feed1.ffm
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: –prefix=/usr –libdir=/usr/lib –shlibdir=/usr/lib –mandir=/usr/share/man –enable-static –enable-shared –cc=i686-pc-linux-gnu-gcc –disable-altivec –disable-debug –disable-audio-oss –disable-opts –enable-libmp3lame –enable-libvorbis –enable-libogg –enable-libtheora –enable-libogg –enable-liba52 –enable-dc1394 –enable-pthreads –enable-libxvid –enable-x11grab –enable-libogg –enable-libx264 –enable-libfaad –enable-libfaac –enable-libamr-nb –enable-libamr-wb –enable-gpl –enable-pp –enable-swscaler –disable-strip
libavutil version: 49.4.0
libavcodec version: 51.40.4
libavformat version: 51.12.1
built on Sep 25 2007 15:25:17, gcc: 4.2.0 (Gentoo 4.2.0 p1.4)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13930 0 13930 0 0 8603 0 –:–:– 0:00:01 –:–:– 14214Input #0, mjpeg, from \’pipe:\’:
Duration: N/A, bitrate: N/A
Stream #0.0: Video: mjpeg, yuvj420p, 320×240, 4.00 fps(r)
100 26439 0 26439 0 0 10188 0 –:–:– 0:00:02 –:–:– 13516Output #0, ffm, to \’http://localhost:8090/feed1.ffm\’:
Stream #0.0: Video: flv, yuv420p, 320×240, q=1-5, 500 kb/s, 4.00 fps(c)
Stream mapping:
Stream #0.0 -> #0.0
[flv @ 0xb7d8f708]removing common factors from framerate
[flv @ 0xb7d8f708]rc buffer underflow
100 37476 0 37476 0 0 10451 0 –:–:– 0:00:03 –:–:– 12716humpback@sam:~$
Adding the CustomLog directive and looking at the output gives:
127.0.0.1 - - [Tue Sep 25 18:05:45 2007] \
on 25 Sep 2007 at 8:19 pm 25.Daantje said …
What do you get when you only run
curl http://10.2.50.160:8081/
You get a growing file or does it stop?
And when it stops, is there a error?
Did you check your logs?
on 27 Sep 2007 at 11:10 am 26.Gustavo Felisberto said …
I get a growing file, if i see the logs i see:
127.0.0.1 - - [Tue Sep 25 18:08:57 2007] GET feed1.ffm HTTP/1.1 200 4165
127.0.0.1 - - [Tue Sep 25 18:08:57 2007] GET /feed1.ffm HTTP/1.1 200 4165
127.0.0.1 - - [Tue Sep 25 18:08:57 2007] POST /feed1.ffm HTTP/1.1 404 141
on 27 Sep 2007 at 11:56 am 27.Daantje said …
And what if you do:
curl http://10.2.50.160:8081/
I think there is a problem, is that a mjpeg stream there?
on 27 Sep 2007 at 2:09 pm 28.Gustavo Felisberto said …
curl http://10.2.50.160:8081/ will get me a lot of output to the console. The url is provided by “motion” http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome and it is mjpeg stream ( i use cambozola to see it http://www.charliemouse.com/code/cambozola/ )
on 07 Oct 2007 at 12:48 am 29.roy said …
hi
is there a correct ling for the ffmpeg ?
on 15 Oct 2007 at 10:57 am 30.samuel said …
hi
i try your post code, very good and work,
but another question for use as below
1. open this browser, this video not real time?
that be delay for a while..
2. if i want transfer to wmv, how to?
thank you
on 15 Oct 2007 at 11:14 am 31.Daantje said …
You should get those questions answered by reading the manual pages on the wmv codec stuff of ffserver… I hope ;) I don’t use the windows codecs…
on 15 Oct 2007 at 3:00 pm 32.samuel said …
thank u reply my Q..
i read many page for ffserver, but success only your step…
try to find ffmpeg menu for wmv, but fail,
becouse they suppose we run capture card at PC.
so their path is /dev/video …., not ip
can you tell me how to save this streaming to a mpeg file?
TKS
on 15 Oct 2007 at 3:39 pm 33.Daantje said …
But what is the output of /dev/video ? MPEG? MJPEG? AVI?
on 16 Oct 2007 at 5:01 am 34.samuel said …
the src video = MJPEG
src video like this url http://192.168.0.2/getimage?camera=1fmt=sif
dest video = mpeg
dest video want be a mpeg file, and streaming to broadcast it
tks
on 27 Nov 2007 at 1:57 pm 35.elio said …
hi
i try your code, but I have an error like this:
> in ffmpeg
my ffmpeg version is SVN-r11093 and
libavutil version: 49.5.0
libavcodec version: 51.48.0
libavformat version: 52.0.0
Have a suggest ?
tks
on 27 Nov 2007 at 2:00 pm 36.elio said …
hi
i try your code, but I have an error like this:
in ffmpeg
my ffmpeg version is SVN-r11093 and
libavutil version: 49.5.0
libavcodec version: 51.48.0
libavformat version: 52.0.0
the command like this:
/usr/bin/curl http://myip:port/control/faststream.jpg?stream=full&fps=6 | ffmpeg -er 4 -y -v quiet -an -f mjpeg -r 4 -i - http://localhost:8090/feed1.ffm;
Have a suggest ?
tks
on 27 Nov 2007 at 2:02 pm 37.elio said …
Sorry I don’t send my error, that is:
pipe:: could not find codec parameters
tks
elio
on 04 Jan 2008 at 8:38 pm 38.Brent said …
I\’m getting this to work mostly, but not when I try to hit my test.swf file it takes forever to load - I\’m assuming it just gets to be huge?
on 23 Jan 2008 at 4:07 pm 39.carlos said …
Hi,
I configured my ffserver as written in the documentation, and started start.sh. no problem till here. But when I try to test the from the browser I get nothing. My camera is axis205 and streams mjpeg.
Note: camera is working, you can see it from here, it is a public, university view camera:
http://bidb.metucam.metu.edu.tr
and my start.sh is as follows:
#!/bin/bash
ffserver;
curl http://bidb.metucam.metu.edu.tr/axis-cgi/mjpg/video.cgi?resolution=320×240 | ffmpeg -er 4 -y -v quiet -an -f mjpeg -r 4 -i - http://localhost:8090/feed1.ffm;
Any idea?
on 10 Feb 2008 at 5:19 pm 40.Martijn Bakker said …
Hi,
Nice article! But ive got issues with streaming the FLV. When i view it via the swf file, its working, but when i try to stream the flv, i get nothing, it keeps loading and loading. Also i get a lot of [flv @ 0xb7ea2f08]rc buffer underflow
What can i do to get my FLV stream working,
Thanks in advance,
Martijn Bakker
on 25 Mar 2008 at 7:48 pm 41.Tony Z said …
Oh my, it really worked. I spent about 18 hours trying to get the right combination of settings. It appears that these settings are the ones that worked in the end, and I only needed to change the rate at which my camera pushes the image on the camera itself. Other possible suspects were an outdated version of Fffmpeg. Checkout from SVN when possible. Ffserver also appears to be very picky about the encoding of the ffserver.conf file itself.
I noticed that the stream doesn\’t seem to display correctly until after waiting a minute or two. Also, there always is one \
on 25 Mar 2008 at 8:07 pm 42.Tony Z said …
Well, it was working. The ffserver is still running and streaming. I sat and watched the SWF playing live in my browser for about 30 minutes. My final test was to reload the browser to see if it would still work, and it did not. :(
on 25 Mar 2008 at 8:10 pm 43.Tony Z said …
Why is it that the SWF doesn’t display anything until the stream first experiences a “buffer underflow”? I was having a lot of those errors at first, now I just get one, then it runs stable and indefinitely.
on 25 Mar 2008 at 11:04 pm 44.Daantje said …
Ah, I have the same problem with the last two updates of ffmpeg…
I have a crude solution what I use:
to keep ffmpeg running I have this script (server.sh):
========
#!/bin/bash
while [ 1 ]
do
ffserver -f /etc/ffserver.conf
done
========
And I start this like this:
$> nohup ./server.sh &
And a file ‘reset.sh’:
========
#!/bin/bash
while [ 1 ]
do
killall -9 ffmpeg
killall -9 curl
sleep 3600
done
========
started like this:
$> nohup ./reset.sh &
Now the stuff is resetted after one hour…
Now when ffmpeg is killed by reset.sh, the server.sh fires the ffmpeg server again…
You should have this when you do:
$> ps -auxf
daantje 2473 0.0 0.1 2640 1228 ? S 2007 0:00 /bin/bash ./start.sh
daantje 1420 0.5 0.1 4696 1768 ? S 02:56 0:18 \_ curl http://10.0.0.106/axis-cgi/mjpg/video.cgi?resolution=640×480
daantje 1421 31.5 0.5 12176 4988 ? R 02:56 18:21 \_ ffmpeg -er 4 -y -v quiet -an -f mjpeg -r 4 -i - http://localhost:80
daantje 2896 0.0 0.1 3124 1472 ? S 2007 0:00 /bin/bash ./server.sh
daantje 32471 0.1 0.2 8928 2136 ? S Jan06 1:03 \_ ffserver -f /etc/ffserver.conf
daantje 7520 0.0 0.1 3136 1452 ? S 2007 0:00 /bin/bash ./reset.sh
daantje 1419 0.0 0.0 1696 432 ? S 02:56 0:00 \_ sleep 3600
Simple but real crude… It keeps running… When I have a better sollution I wil post it here.
on 12 Apr 2008 at 1:11 am 45.jim said …
Fantastic you got this going with another series of cameras!
Still want to do a lot to make this a solid service. I found a lot of issues with keeping my daemon alive and I think sCurl might be a little more robust in it\’s ability to stay alive than a php/perl/python script running as a daemon. I\’ve seen ffserver crash out a bunch as well - which I\’d like to somehow figure out why. The best I had my setup running for was 1.5weeks before having ffserver just core dump on me.
linkback: http://www.overset.com/2007/01/22/live-streaming-of-a-webcam-feed-from-canon-vb-c10c50-from-a-relay-proxy-server/
on 13 Apr 2008 at 9:08 pm 46.dirk maas said …
Now look at this:
http://www.berlinstream.de
It’s an Axis webcam though.
on 14 Apr 2008 at 1:57 pm 47.Nikola Savic said …
Since latest versions of ffmpeg have unstable ffserver :(, is there any chance you can send me archive of your ffmpeg source.
Thank you in advance!
Best Regards,
Nikola
on 14 Apr 2008 at 2:26 pm 48.Daantje said …
Mine is just as unstable, check comment #40…
on 28 Apr 2008 at 4:10 pm 49.awelzl said …
HEEEEEELP!!!! Thx for your perfect hints, but I cannot get ANY picture streamed. Neither .swf nor .flv is being streamed. I just get a blank browser (IE7 / FF2). And the log file shows only http access entries, but not more. If I try to start everything from the console, it doesnot change anything either.
If I try to wget the AXIS-stream for testing, that works on the relay server. My equipment is a AXIS 211W.
Thx in advance!
on 28 Apr 2008 at 4:33 pm 50.awelzl said …
One more notice …
I cannot see any curl process running in the processlist. As soon as I curl the URL from the console it show weired output - so I assume the curl is doing its job. But why does curl not pipe the stuff into the file?
Thx!
on 29 May 2008 at 5:42 pm 51.romualdo said …
Hi, I am trying to configure using the Pelco cam Spectra IV with net300 encoder, but i dont know how to get the mpeg stream any help will be great.
Tks
on 29 May 2008 at 5:43 pm 52.romualdo said …
Hi, I am trying to configure using the Pelco cam Spectra IV with net300 encoder, but i dont know how to get the mpeg stream using the curl command, any help will be great.
Tks
on 28 Aug 2008 at 3:10 pm 53.matt said …
Thanks for this. Its working fine for me.
Streaming from an axis 211.
on 03 Sep 2008 at 10:49 pm 54.dave said …
Is it possible to get the audio stream (of an Axis 207 or 214, via rtsp://.. ..amp, rtsp://.. ..3gp or axis-cgi script receivement and conversion) with this method?
on 03 Sep 2008 at 11:12 pm 55.Daantje said …
Do not know, didn’t try. But I think so. I still have the idea to add the icecast mp3 stream, but have no time to fiddle with the config.
on 30 Sep 2008 at 2:04 pm 56.Winky said …
Greetings, I\\\’ve got problem when I run the script:
ffmpeg version CVS, build 3276800, Copyright (c) 2000-2004 Fabrice Bellard
configuration: –extra-cflags=-fomit-frame-pointer -DRUNTIME_CPUDETECT –build i486-linux-gnu –enable-gpl –enable-pp –enable-zlib –enable-vorbis –enable-libogg –enable-theora –enable-a52 –enable-dts –enable-dc1394 –enable-libgsm –disable-debug –prefix=/usr
built on Nov 24 2005 10:19:02, gcc: 4.0.3 20051121 (prerelease) (Ubuntu 4.0.2-4ubuntu3)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1263 0 1263 0 0 10734 0 –:–:– –:–:– –:–:– 10734Stream mapping:
Stream #0.0 -> #0.0
100 148k 0 148k 0 0 107k 0 –:–:– 0:00:01 –:–:– 116k
curl: (23) Failed writing body
./start.sh: line 2: 20978 Exit 23 curl http://root:toor@10.10.10.236/axis-cgi/mjpg/video.cgi?resolution=640×480
20979 Floating point exception| ffmpeg -er 4 -y -v quiet -an -f mjpeg -r 4 -i - http://localhost:8090/feed1.ffm
If you know what\\\’s the problem, or got any solutions for this, I\\\’d be very gratefull
on 30 Sep 2008 at 2:19 pm 57.Winky said …
Allright, you can tell me that I need to download newest SVN, but when i do that, and type ./configure i get this message :
gcc is unable to create an executable file.
If gcc is a cross-compiler, use the –enable-cross-compile option.
Only do this if you know what cross compiling means.
C compiler test failed.
If you think configure made a mistake, make sure you are using the latest
version from SVN. If the latest version fails, report the problem to the
ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file “config.err” produced by configure as this will help
solving the problem.
and from there, i cannot get anywhere :D
on 28 Oct 2008 at 7:40 pm 58.Art said …
Can this be used to stream multiple cams?
I am trying to stream my office survellience cams (which all have a unique IP feeding out mpg or avi) to the 10 or so users that think they have to babysit the building rather than do their jobs all day long.
When 2 or 3 users log on the stream gets very slow and starts pausing, I’m thinking if I put a webserver with ffmpeg and stream the FLV that i should be able to cure the heavy load on the stream correct?
I have 10 different streams that I need to do this with.
on 28 Oct 2008 at 9:44 pm 59.Daantje said …
Yes, converting a stream takes a lot of CPU. So with 10 streams running always, you’ll need one real monster machine, or take several. But when it’s only for security, I would take the normal stream of the cam to store, and only start ffmpeg when a stream is live viewed. So you’ll need some kind of trigger on load, which should start a ffmpeg session on the server. I would do that with a new Flash file that does a loadVariablesNum(”some_script_that_starts_ffmpeg.php”) The script should return some var when the ffmpeg stream is started. When the var is filled, show a FLVplayback component with the ffmpeg stream. Do not forget to add to the preferences of the FLVplayback component that the stream is a live stream, ore else it will wait for meta data. And it will not get any from a live stream I think.
on 03 Dec 2008 at 5:36 pm 60.Daantje said …
Winky,
curl: (23) Failed writing body…
It seams that you are writing to a file? And not to ffmpeg?
on 07 Jan 2009 at 8:42 pm 61.Vince said …
I have been trying for quite a while to get an axis camera stream into flash. Seems like quite a hack to get another computer involved to restream the stream to flash.
I\’ve seen this url work:
http://user:password@server:port/axis-cgi/mjpg/video.swf?resolution=320×240
but after a few frames it usually cuts out and the image is not refreshed anymore.
If anyone else knows how to solve this, I would love to hear it, I\’ve been banging my head on this one for quite some time. If I knew how this swf was created, I would just re-create a new FLA, recompile it without the bug and upload it to the scripts section of the axis camera flash file system.
Let me know if you have any ideas…
on 15 Jan 2009 at 10:28 am 62.Olli said …
Look what you made possible ;-)
http://hurenkinder.o-byte.com/dynamic_flash
on 02 Mar 2009 at 5:45 pm 63.Matija said …
Anybody found better solution to restart ffmpeg streaming?
I am using 3 streams and after a few hours streams doesn`t work anymore. Daantje, your script restarts just ffserver and not ffmpeg??
on 02 Mar 2009 at 5:55 pm 64.Daantje said …
Yes, ffmpeg is restarted the same way… I’m NOW busy to install a new server, if I can get around this bug I will post it here.
on 02 Mar 2009 at 6:02 pm 65.Daantje said …
There is a option to start ffmpeg as a deamon. Check the /etc/ffserver.conf file.
# Suppress that if you want to launch ffserver as a daemon.
NoDaemon
on 02 Mar 2009 at 6:05 pm 66.Daantje said …
hmmmmm….. check this;
File /tmp/feed1.ffm
FileMaxSize 5M
FileMaxSize 5M …. maybe remark this one…
on 04 Mar 2009 at 1:23 pm 67.sulek said …
Hello
I have problem with livestreaming swf file, what I see in the browser is from 5sec to 2-5min old, I don\’t now what to do to get it work like a live view from camera… I\’m using axis 207… pleas help ;/
on 04 Mar 2009 at 1:31 pm 68.Daantje said …
I have the same problem with mjpeg. But the 207 has a swf feed too, use that one…
on 04 Mar 2009 at 1:43 pm 69.sulek said …
i have something like this:
curl http://user:pass@192.168.10.100/axis-cgi/mjpg/video.swf?resolution=640×480 | ffmpeg -er 4 -y -v 10 -an -f mjpeg -r 8 -i - http://localhost:8090/feed1.ffm;
but it is wrong and puts out error:
[mjpeg @ 0×88c4500]mjpeg decode frame unused 0 bytes
[mjpeg @ 0×88bb290]Could not find codec parameters (Video: mjpeg)
pipe:: could not find codec parameters
i need to put that swf strem from camera through the ffmpeg server, do you know what to change in that curl line ??
on 04 Mar 2009 at 1:54 pm 70.Daantje said …
ffmpeg -f swf
should be better ;) You’re getting swf not mjpeg anymore…
So:
mjpeg should be swf in your line
on 04 Mar 2009 at 2:12 pm 71.sulek said …
like this : ;)
curl http://user:pass@192.168.10.100/axis-cgi/mjpg/video.swf?resolution=640×480 | ffmpeg -er 4 -y -v 10 -an -f swf -r 8 -i - http://localhost:8090/feed1.ffm;
but is still isn\\\’t working :( :
pipe:: could not find codec parameters
on 04 Mar 2009 at 2:22 pm 72.Daantje said …
You’ll need extra codec libs! Check the ffmpeg codec documentation? I’m in the dark too… Don’t have the time to test it now, but friday i’m doing exactly the same thing with a 207w… So i’ll keep you informed when I have the answer…
on 10 Mar 2009 at 12:36 am 73.Daantje said …
It looks like that when I use wget instead of curl the whole bunch is working more stable:
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:8091/feed1.ffm
on 10 Mar 2009 at 12:37 pm 74.Matija said …
ok, i think mine is working now :)
ffmpeg -s qvga -er 4 -y -an -f mjpeg -i http://xx.xx.xx.xx/mjpg/video.mjpg http://localhost:8090/feed2.ffm
I`m not using wget or curl, instead directly input of ffmpeg (-i url://) and its working fine, just for percaution I restart a server every 1000 seconds. I first kill everything(ffserver, ffmpeg)…than delete the temporary files, and start all over again. I you somebody wants to see the script I will post it here. It works fine now for a week and a half without touching. Maybe I`ll build in trapping exit signals.
And now my question :). I have to work with another type of the camera IQEYE711 and I cant get any suitable stream signal from it to convert to flash. I found on a forum that is possible streaming and proccessed with VLC but I wasnt able to do that. Has anybody tried to do sth with this?
on 10 Mar 2009 at 1:08 pm 75.Daantje said …
Yes ;) please post! And yes it’s possible with VLC to play any source and transfer it to your ffserver feed. Use the Stream import/export wizard under the file menu in VLC. But if you can view the stream in VLC you should be able to do the same with ffmpeg, it’s the same stuff.
on 10 Mar 2009 at 1:33 pm 76.Matija said …
This is my script: echos are in my slovenian language, in comments you can see it translated :)
while [ 1 ]
do
sleep 4
#start ffserver
ffserver -f /home/matija/start/ffserver.conf &
sleep 2
#ffserver started
echo “zagnan ffserver”
#start stream no.1
nohup /home/matija/start/bernardin.sh > /dev/null &
sleep 2
#stream no.1 started
echo ” zagnan bernardin”
nohup /home/matija/start/novistart.sh >/dev/null &
#stream no2 started
echo ” zagnan pirat”
sleep 1000
#kill ffserver
killall -9 ffserver
#kill stream no.1 (usually it says that its not active,but not allways)
killall -9 ./bernardin.sh
#kill stream no.2 (same as first point)
killall -9 ./novistart.sh
#ok, i`ve killed everything
echo ” ubil sem vseskupaj, hehe”
#delete feeds
rm /tmp/*
echo ” pobrisal sem feede!”
done
and that`s it. In bernardin.sh is just
ffmpeg -s qvga -er 4 -y -an -f mjpeg -i http://xx.xx.xx.xx/mjpg/video.mjpg http://localhost:8090/feed2.ffm
you can see the result in http://www.sailingcircuit.com
bernardin web cam and pirat webcam, now I have to fix the marina webcam(IQEYE711).It wont stream under vlc or ffmpeg and this is making me angry :). If you have any question i will gladly answer it.
on 10 Mar 2009 at 11:52 pm 77.Danelle said …
Cool. This worked perfectly for me. Thanks for posting this !
on 22 Mar 2009 at 1:19 pm 78.Sjors said …
Nice, this solution is running great! We`d like to non commercial stream events with a axis 207 camera.
But it would be nice i`ve we could include audio in this. Has anyone looked into this? Or could tell me a possible solution to get it working.
on 22 Mar 2009 at 3:47 pm 79.Daantje said …
I would like the answer on this too! I’ve looked for it, but couldn’t find it.
on 28 Apr 2009 at 2:54 pm 80.Ivor said …
Daantje, thanks for this! It also worked on a crappy Marmitek robocam.
on 27 Jul 2009 at 7:50 pm 81.Phil said …
I used:
http://blog.ryanparman.com/2008/06/28/installing-ffmpeg-php-fedora-amazon-aws/
on slackware to install ff. This worked 1st time out of the gate on a linksys PVC2300.
One thing to note is this cam has user auth on it so you have to make sure its in the url
ffmpeg -s qvga -er 4 -y -an -f mjpeg -i http://admin:admin@192.168.1.130/img/video.mjpeg http://localhost:8090/feed1.ffm
I also used Matija script above. worked 1st time. Thanks!!!!
on 07 Aug 2009 at 9:38 am 82.Hans Blaauw said …
Great scripts!
Like mentioned before, I also feed the input directly to ffmpeg instead of piping it with wget/curl. It improves the performance a lot.
stream.sh:
#!/bin/bash
while [ 1 ]
do
ffmpeg -er 4 -y -r 5 -f mjpeg -i http://192.168.1.165/axis-cgi/mjpg/video.cgi?resolution=704×576 http://127.0.0.1:8090/feed1.ffm
done
You can also try to grab the RTSP stream (if your cam supports it) by replacing the ffmpeg line with this one:
ffmpeg -er 4 -y -r 5 -f rtsp -i rtsp://192.168.1.165:554/mpeg4/media.amp http://127.0.0.1:8090/feed1.ffm
I think the mjpeg gives a better quality, but the rtsp seems to be a little faster.
on 07 Aug 2009 at 10:01 am 83.Hans Blaauw said …
Hmm.. I fact it wasn’t the pipes what causes the bad performance, but the MJPEG. I tested some more and find out the MJPEG was becoming slower and slower (1 second took 10 real seconds). By using the RTSP stream it looses some frames, but it’s much faster. It only takes 4% cpu load on a slow machine, instead of 20 to 40 for MJPEG.
on 10 Sep 2009 at 1:49 pm 84.Vasanthi said …
Hi,
On following this , I get the test.swf to be blank and also I am getting the error as Could not find codec parameters (Video: mjpeg) on running the start.sh What could be the issue
on 10 Sep 2009 at 2:00 pm 85.Daantje said …
I had the same problem, got an other version of ffmpeg and it worked. Do not know why.