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 665887 - multipartdemux: boundary specified manually but gst quits because "Boundary not found"
multipartdemux: boundary specified manually but gst quits because "Boundary n...
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-12-09 21:10 UTC by Roman Gaufman
Modified: 2018-11-03 14:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to not ignore specified boundary (1.73 KB, patch)
2012-02-21 14:48 UTC, Roman Gaufman
none Details | Review

Description Roman Gaufman 2011-12-09 21:10:17 UTC
I have a D-Link DCS-930L IP camera and when I get mjpeg from it, it looks something like this:

# wget http://user:pass@192.168.1.15/video/mjpg.cgi mjpg.cgi contents:
Content-length: 45536
Date: 10-04-2011 07:41:20 PM IO_00000000_PT_000_000
Content-type: image/jpeg
(jpeg data)
--video boundary--
Content-length: 45607
Date: 10-04-2011 07:41:20 PM IO_00000000_PT_000_000
Content-type: image/jpeg
(jpeg data)

So the boundary is "--video boundary--" - I try to specify this to gstreamer with:

multipartdemux boundary="--video boundary--"

Yet I still get the following whether I specify the boundary or not:

Boundary not found in the multipart header
ERROR: pipeline doesn't want to preroll.
Comment 1 Vincent Penquerc'h 2011-12-10 10:53:58 UTC
Can you include a real sample (the elided one above will have wrong Content-length, the value of which is used by the element when scanning for the boundary).
Comment 2 Vincent Penquerc'h 2011-12-10 10:55:35 UTC
Also, I think it should be: boundary="video boundary", ie without the leading and trailing double dashes, please try with that.
Comment 3 Vincent Penquerc'h 2011-12-10 12:54:26 UTC
Oh wait...
The first boundary has a "--" at the end. This is supposed to mark the end of the parts... See 7.2.1 in http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html.
Then a boundary of "video boundary--" should work, though it will never see the end, but that might be OK in this case.
Comment 4 Roman Gaufman 2011-12-10 13:35:23 UTC
I tried multipartdemux boundary="video boundary--" - no difference.

This for example works:

( echo "--video boundary--"; curl ${URL}mjpeg.cgi; ) | gst-launch -e -v \
  matroskamux name=mux ! filesink location="out.mkv" \
  fdsrc do-timestamp=true ! multipartdemux boundary="video boundary--" ! image/jpeg,width=640,height=480 ! mux.

But if I use souphttpsrc, it just says: "Boundary not found in the multipart header"

Here is live access to the specific IP camera: http://admin:@82.13.197.168:82/video.cgi
Comment 5 Vincent Penquerc'h 2011-12-12 12:25:43 UTC
I just had a look at that stream, and you're right, it's just missing the boundary at start.
However, looking at the RFC, this still might stilll be supposed to work, with the first image, in the absence of that boundary, to be considered to be a prologue. Since there is no "Content-type: multipart/mixed" in the stream, I'm far from certain what's the expected behavior...
Comment 6 Roman Gaufman 2011-12-13 00:04:38 UTC
It seems that right now gstreamer doesn't really care if there is a "Content-type: multipart/mixed" or not but strictly speaking, yeh, pretty shameful of D-Link not to include it in their multipart stream :( - unfortunately it isn't just D-Link and quite a range of IP cameras don't follow the RFC very well.

FFMPEG and VLC don't appear to care and figure out the boundary on their own - at the very least it would be nice for gstreamer to not look for a boundary in the multipart header if a boundary is specified manually. What do you think?
Comment 7 Vincent Penquerc'h 2011-12-13 12:16:45 UTC
Sorry, I was not commenting on the actual gst code, saying it would work if multipart/mixed was present, but on the RFC (of wihch I know just what I read the last few days, I'd never done anything with multipart stuff before).
It would seem best if gst would parse this fine (though I'm always a bit wary of encouraging writing bad data by accepting it), I'm not sure yet of all the issues as I've only looked at this a few minutes at a time so far :)
Comment 8 Roman Gaufman 2012-02-19 20:57:43 UTC
Just tried latest git version and this is still a problem.

This works fine:

 ( echo "--video boundary--"; curl http://admin@192.168.0.108/mjpeg.cgi; ) | gst-launch -e -v   matroskamux name=mux ! filesink location="out.mkv"   fdsrc do-timestamp=true ! multipartdemux boundary="video boundary--" ! image/jpeg,width=640,height=480 ! mux.

However this does not: 

( curl http://admin@192.168.0.108/mjpeg.cgi; ) | gst-launch -e -v   matroskamux name=mux ! filesink location="out.mkv"   fdsrc do-timestamp=true ! multipartdemux boundary="video boundary--" ! image/jpeg,width=640,height=480 ! mux.

I get the error: Boundary not found in the multipart header.

I still don't understand the rationale behind forcing a boundary in the header check when a boundary is provided manually via the "boundary" property.

Anyone?
Comment 9 Vincent Penquerc'h 2012-02-19 23:51:22 UTC
Nobody's hacked on it yet.
The rationale is to follow the spec. Someone has to do the code to support this particular brokenness. Shouldn't be too long once someone gets to it.
Comment 10 Roman Gaufman 2012-02-21 14:48:49 UTC
Created attachment 208126 [details] [review]
Patch to not ignore specified boundary

This patch seems to fix the problem for me
Comment 11 André Klapper 2012-05-01 12:26:55 UTC
Comment on attachment 208126 [details] [review]
Patch to not ignore specified boundary

[Fixing wrong mime type and set "patch" flag so it can be queried for.]
Comment 12 Edward Hervey 2018-05-08 05:32:21 UTC
At a glance, that patch still seems valid but:
* Quite a few changes went into multipartdemux so the patch should be rebased
* It would be great to have a new test stream to test against

Roman do you still have the stream available somewhere ?
Comment 13 GStreamer system administrator 2018-11-03 14:45:04 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/52.