After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 318663 - http mjpeg stream from axis 213 PTZ camera
http mjpeg stream from axis 213 PTZ camera
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other All
: Normal normal
: 0.10.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 324382 (view as bug list)
Depends on:
Blocks: 138435
 
 
Reported: 2005-10-12 12:12 UTC by Pierre Cassimans
Modified: 2006-12-10 19:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
stream from camera (646.81 KB, application/octet-stream)
2005-10-12 12:18 UTC, Pierre Cassimans
  Details
make it works in cvs head (7.18 KB, patch)
2005-12-09 14:51 UTC, Luca Ognibene
none Details | Review
updated patch against current cvs (7.09 KB, patch)
2005-12-18 17:04 UTC, Luca Ognibene
none Details | Review

Description Pierre Cassimans 2005-10-12 12:12:57 UTC
Please describe the problem:
stream is not displayed when trying to read from a axis 213 ptz ip camera.

Steps to reproduce:
1. gst-launch gnomevfssrc
location=http://192.168.0.2/axis-cgi/mjpg/video.cgi?resolution=CIF !
multipartdemux ! jpegdec ! ffmpegcolorspace ! xvideosink
2. 
3. 


Actual results:
Can't see the stream

Expected results:


Does this happen every time?


Other information:
More docs about the http commands can be found here:
http://www.axis.com/techsup/cam_servers/dev/cam_http_api_index.htm
Comment 1 Pierre Cassimans 2005-10-12 12:18:58 UTC
Created attachment 53367 [details]
stream from camera
Comment 2 Pierre Cassimans 2005-10-21 10:13:59 UTC
the problem seems to be the following (thx for the help on irc)

static gchar *toFind = "--ThisRandomString\nContent-type: ";

This --ThisRandomString is --myboundary in the axis header.

Why can't we just put this:
static gchar *toFind = "Content-type: ";

or make a property boundary="--myboundary" for the element.
Comment 3 Edward Hervey 2005-11-21 18:03:00 UTC
Updating to 0.9.

This is really peculiar, the server sends in fact multipart via http.

This is more a problem in gnomevfssrc.... but how would they handle that ? It's
one URI, therefore it should only return one file (and not multiple)...

http://www.axis.com/techsup/cam_servers/dev/cam_http_api.htm#api_blocks_jpeg_mjpg_mjpg_response
Comment 4 Luca Ognibene 2005-12-09 14:51:25 UTC
Created attachment 55809 [details] [review]
make it works in cvs head

This patch: 
 - remove the hardcoded prefix
 - add a "prefix" property. The default is the old hardcoded one.
 - add a "autoscan" property (default false). If you set the autoscan to true
it tries to find the prefix looking at the beginning of the first buffer. 
 - add a finalize function to free the prefix

I can now play the file using:
./gstreamer/tools/gst-launch-0.10 filesrc location="/home/luogni/stream.mjpg" !
multipartdemux autoscan=true ! image/jpeg,framerate:fraction=10/1 ! jpegdec !
ffmpegcolorspace ! ximagesink

or

 ./gstreamer/tools/gst-launch-0.10 filesrc location="/home/luogni/stream.mjpg"
! multipartdemux prefix="boundary" ! image/jpeg,framerate:fraction=10/1 !
jpegdec ! ffmpegcolorspace ! ximagesink
Comment 5 Edward Hervey 2005-12-09 15:12:07 UTC
it would be nice also to have a typefind function for these streams (multipart).
Would this be possible ?
Comment 6 Luca Ognibene 2005-12-09 15:45:01 UTC
These files start with something like:
PREFIX\r\nsome_http_like_options\r\n\r\n
Then there is the data, \r\n and then a new header. The prefix always (at least
in every ip camera that i've seen) starts with "--"
We can do an alg that looks for:
--\s+\r\n\s+\r\n\r\n
I can work on a similar alg if you think it would be ok. If we do typefinding we
should also enable multipartdemux's autoscan feature by default. Would this
break element compatibility ?
Comment 7 Luca Ognibene 2005-12-18 17:04:15 UTC
Created attachment 56116 [details] [review]
updated patch against current cvs
Comment 8 Luca Ognibene 2005-12-18 17:05:02 UTC
*** Bug 324382 has been marked as a duplicate of this bug. ***
Comment 9 Luca Ognibene 2005-12-18 17:42:18 UTC
There are some problem with a pipeline like: 
/home/luogni/Sorgenti/devel/0.9/gstreamer/tools/gst-launch-0.10 gnomevfssrc location=http://stareat.it.helsinki.fi/mjpg/video.mjpg ! multipartdemux prefix=boundary ! identity ! jpegdec ! fakesink -v

We should see the same amount of buffers on identity and on fakesink. Instead it seems that jpegdec "eats" some buffers.. I don't know if it's a problem with multipartdemux or with jpegdec or just a broken stream (firefox can play it w/o problems)
Comment 10 Tim-Philipp Müller 2005-12-18 18:02:05 UTC
jpegdec's parser seems to be a bit generous when resyncing to the next jpeg frame, so there's definitively a bug in jpegdec as well (it should do the right thing in this case even without the multipartdemux element in a perfect world).

However, multipartdemux should probably also add a 'framed=true' value to the caps or something like that, that would by-pass jpegdec's parsing and be more efficient (jpegdec would need to be fixed to honour that, but that's a 2-line change in its setcaps function; currently it only assumes framed input when the sink pad caps have a framerate set).
Comment 11 Wim Taymans 2006-02-13 12:00:47 UTC
anoying thing really.. the boundary string is normally conveyed to the demuxer in the http response headers. gnomevfssrc does not really pass that info along. A property is a bit useless, scanning looks nicer although I have no idea how many false positives it gives.
Comment 12 Wim Taymans 2006-02-16 16:54:56 UTC
ok, tested and it gives quite a few false positives currently. It should probably also scan for Content-type: after the \r\n etc.
Comment 13 Wim Taymans 2006-02-16 16:56:53 UTC
        * gst/multipart/multipartdemux.c: (gst_multipart_demux_base_init),
        (gst_multipart_demux_class_init), (gst_multipart_demux_init),
        (gst_multipart_demux_finalize), (gst_multipart_find_pad_by_mime),
        (gst_multipart_demux_chain), (gst_multipart_demux_change_state),
        (gst_multipart_set_property), (gst_multipart_get_property):
        Applied #318663. Gives quite a few false positives in
        autoscan mode, but it's better than nothing. Not closing yet.
Comment 14 Wim Taymans 2006-03-02 20:14:34 UTC
does this work?
Comment 15 Tim-Philipp Müller 2006-04-10 16:38:50 UTC
What's the status here? Can this be closed or is there anything that should still be implemented?
Comment 16 Wim Taymans 2006-07-16 11:22:38 UTC
closing, reopen if needed info was given.