Page 1 of 1

Any way to control/limit MJPEG fps ?

Posted: Fri Feb 18, 2011 7:30 pm
by bdmcnxn
Hi,

Got a few of those Foscam knockoffs for my home. These IP cams provide 3 ways to get audio/video feed from the cameras:-

1) Snapshot cgi (client pull -- single Image only)
2) MJPEG cgi (server push -- Video only)
3) ASF cgi (server push -- Audio-ADPCM, Video-MJPEG)

Now my need is to capture both audio and video, but at very low video frame-rates. However, from what I've understood about MJPEG, there is no way to set the MJPEG source fps. Is this correct ?

Apparently, the camera has a Internet-Explorer only OCX, that (I think) reduces the display-fps, while the server-fps (rate of push) is high.

Initially I thought of doing snapshot.cgi (client pull) for say something like 1fps video, and pick the audio stream from the .asf, however the .asf will also contain MJPEG video at full fps, i.e. how fast the camera's encoding processor can spew out frames! Any alternatives ?

thanks,
bdm

Posted: Sat Feb 19, 2011 7:58 am
by Flash_
If you're doing low fps, use the jpg.

Some cameras (Axis) allow you to set the mjpeg fps by default or by url (&req_fps=5) but most of the cheaper bracket just throw as much as they can at you. That fps varies depending on the number of simultaneous viewers so isn't even slightly predictable. zm just discards frames it doesn't want if it gets too many, but that does use some cpu.

If you're unsure, watch the system load AND fps on each method at the fps you desire. At low, fps, jpg will be better. At high, mjpeg. Also less chance of going out of sequence at higher fps with mjpeg.

But... no idea how you're going to achieve the audio bit you want. zm doesn't do that.

Posted: Sat Feb 19, 2011 8:34 pm
by kingofkya
ABout 2/3 of the way down http://howto-pages.org/ffmpeg/

ffmpeg -i mandelbrot.flv -vn -acodec copy mandelbrot.mp3

will strip the audio off the file.

Posted: Sun Feb 20, 2011 4:12 am
by bdmcnxn
Thanks @Flash_.
Flash_ wrote:If you're doing low fps, use the jpg.
I guess, for low fps the repeated http requests don't add significant overhead, so it might just be fine.
Flash_ wrote:Some cameras (Axis) allow you to set the mjpeg fps by default or by url (&req_fps=5) but most of the cheaper bracket just throw as much as they can at you. That fps varies depending on the number of simultaneous viewers so isn't even slightly predictable. zm just discards frames it doesn't want if it gets too many, but that does use some cpu.
Ok, great. Clearly you get what you pay for. In my case max. no. of viewers would be 2 at the most, however I just can't seem to get over 7-8fps in all my tests so far. This is with just 1 user connected to cam. My test setup however is somewhat crude. I just use mplayer to play first 500 frames and measure time taken to do so using unix 'time'.
Flash_ wrote:If you're unsure, watch the system load AND fps on each method at the fps you desire. At low, fps, jpg will be better. At high, mjpeg. Also less chance of going out of sequence at higher fps with mjpeg.
Ok, good idea of watching the system load and fps. BTW, by watching fps, do you mean the one shown by ZM ? I'm yet to get a good hang of ZM's fps reporting. I am guessing it's the fps which ZM restreams, not the incoming fps.
Flash_ wrote:But... no idea how you're going to achieve the audio bit you want. zm doesn't do that.
Found some old posts with another FOSS tool called "listener" to do this task, but then it doesn't do streamed audio/video capture, but only from local /dev/audio on linux box.

Posted: Sun Feb 20, 2011 4:17 am
by bdmcnxn
Thanks kingofkya.
kingofkya wrote:ABout 2/3 of the way down http://howto-pages.org/ffmpeg/

ffmpeg -i mandelbrot.flv -vn -acodec copy mandelbrot.mp3

will strip the audio off the file.
Right, but that command is extracting audio from a local .flv file. What I need to do is extract audio, on the fly, from streaming ASF file (audio+video stream).

After a bit of searching found about mplayer and mencoder, which may be able to do similar thing, but then I am really missing the nice features of another FOSS project "listener" which is Vox, voice activated recording.
[/u]

Re: Any way to control/limit MJPEG fps ?

Posted: Tue Mar 29, 2011 11:57 am
by melissia
You can only run this OOB becuase of the crossdomain.xml policy goodness in Silverlight. The cameras don't have this file on their internal webserver, so browser-based Silverlight won't work at all. That said, even OOB apps can't modify the User-Agent header either via the Headers collection or the UserAgent property.