<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi to all,<br>
<br>
I'd like to stream live, continuous Motion JPEG throught nginx web
server. Right now, I have a little program that captures the frames
from my hardware, separates them with boundaries and send them to
stdout. Here's, schematically, what my program does:<br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
// As soon as someone connects <br>
<br>
fprintf (stdout, "Connection: close"\<br>
"\r\n" \<br>
"Cache-Control: no-store, no-cache,
must-revalidate, pre-check=0, post-check=0, max-age=0" \<br>
"\r\n" \<br>
"Pragma: no-cache" \<br>
"\r\n" \<br>
"Content-Type: multipart/x-mixed-replace;boundary="
BOUNDARY \<br>
"\r\n" \<br>
"\r\n" \<br>
"--" BOUNDARY "\r\n");<br>
<br>
[...]<br>
<br>
while (1) {<br>
<br>
//Magically take the frame from the shared memory<br>
<br>
fprintf(stdout, "Content-Type: image/jpeg\r\n" \<br>
"Content-Length: %d\r\n" \<br>
"\r\n", frame_length);<br>
<br>
DBG("Sending MJPEG frame\n");<br>
<br>
if ((fwrite(frame_data, frame_length, sizeof (char) , stdout))
== 0 ) {<br>
ERR ("Error sending frame");<br>
break;<br>
}<br>
<br>
DBG("Sending boundary\n");<br>
<br>
fprintf(stdout, "\r\n--" BOUNDARY "\r\n");<br>
}<br>
<br>
<br>
<br>
I've seen examples of nginx modules that stream h264 files, but this
case is quite different: live streaming means a potentially infinite
MJPEG stream and no buffering done by the webserver.<br>
<br>
I'm an nginx beginner, so I'm asking for some directions.<br>
<br>
How can I stream this (potentially infinite) series of frames? A CGI
is sufficient o will I need to write a module? Is it even possible
to do something like this with nginx?<br>
<br>
Thanks,<br>
Cristiano.<br>
<br>
-- <br>
<div class="moz-signature">
<title></title>
Belloni Cristiano<br>
Imavis Srl.<br>
<a href="http://www.imavis.com">www.imavis.com</a><br>
<a href="mailto://belloni@imavis.com">belloni@imavis.com</a><br>
</div>
</body>
</html>