defvol / Paparazzo.js

A high performance web proxy for serving MJPG streams to the masses.
197 stars 38 forks source link

Possible to support mjpg streams with no content-length header? #7

Open MatthewBergsma opened 11 years ago

MatthewBergsma commented 11 years ago

I've got a few mjpg streams coming from a desktop app (evocam) - and they aren't being scraped correctly by the node process.

After debugging a bit I noticed that the app is not setting a content-length header for each frame of the mjpg stream.

Do you have any insights into a way to modify paparazzo to support this use case? I'm not quite sure how to successfully open and close the request without knowing the total size of the object being requested...

defvol commented 11 years ago

we can also infer that we reached a boundary if we find a Content-Type string

check: https://github.com/wilhelmbot/Paparazzo.js/blob/master/src/paparazzo.coffee#L111

MatthewBergsma commented 11 years ago

Hmmm... My streams do have a content type of image/jpeg. I'll look through and see where the script might be "caching" the request too early.

Currently the node JS service just serves up a broken image.

AaronHorn commented 10 years ago

For what it's worth, I had problems with a Panasonic camera. It was reporting it could not determine the next image. I found my data stream did not include Content-Length. It did have Content-Type BUT it was actually Content-type (lowercase t) so I had to modify the js to make it work.

defvol commented 10 years ago

good point @AaronHorn

we could fix the regular expression by adding "i" at the end

/Content-Type:\s+image\/jpeg\s+/i

letting us ignore case:

content-type: image/jpeg Content-Type: image/jpeg cOntent-TYPE: image/jpeg

would you mind sharing a fix?