AXIS NETWORK CAMERAS MJPEG REQUEST

A place for discussion of topics that are not specific to ZoneMinder. This could include Linux, Video4Linux, CCTV cameras or any other topic.
Post Reply
tony77_77
Posts: 4
Joined: Tue Jul 06, 2004 12:35 pm

AXIS NETWORK CAMERAS MJPEG REQUEST

Post by tony77_77 »

Hi,
I'm currently working with Axis networks cameras, and I need to create movies originating from the pictures I get from the cam. I've been told by Axis itself not to use make repeated wget requests using the cgi-bin path, but to do instead request using the /mjpg/video.mjpg path. The request is a lot quicker and more stable. Those who ever used an Axis product sure know what I'm talking about. I'm surely not the first that first thought that I was getting a motion-jpeg stream, but in fact axis's mjpeg means multipart-jpeg. Doing a wget on /mjpg/video.mjpg will result in jpeg images one after the other separated by a tag, boundary content-type jpeg.
My question is: do anyone know how I could process this file with tools such as ffmpeg to create a movie?? I know splitting the file into severals jpeg's would be a solution, but I havent been able to do that without gettting errors..I thank you A LOT for your answers..
cheers
tony
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

It's not too hard to split the stream once you get over the fact that everyone does the stream in a slightly different way. In fact I wouldn't be surprised if ffmpeg took the stream as is and squirted a video out the other end. That's certainly the first thing to try. Otherwise you can look at zm_remote_camera.cpp and do a similar thing, one request, and process each frame separately. ffmpeg will allow you to open pipes to it so you can just fire each decoded frame off and add it to the video.

Phil,
tony77_77
Posts: 4
Joined: Tue Jul 06, 2004 12:35 pm

ffmpeg and mpjpeg

Post by tony77_77 »

hi phil,
thanks a lot for the answer...I'm currently trying to decode the mpjpeg stream with ffmpeg, but the resulting movie is very bad, it seems ffmpeg badly decodes the mpjpeg...
here's the ffmpeg command line:
ffmpeg -f mpjpeg -y -v -an -i video.mjpg -vcodec copy test.avi
and here's the output:
*********************************************************************************
Input #0, mjpeg, from 'video.mjpg':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: mjpeg
Output #0, avi, to 'test.avi':
Stream #0.0: Video: mjpeg, q=2-31
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=11993 q=0.0 Lsize= 12091kB time=479.7 bitrate= 206.5kbits/s
*********************************************************************************
apparently the -f flag doesnt really force the input to mpjpeg.....

Got any Idea??
cheers mate, have a nice day :-)
Post Reply