RTC Forums
July 14, 2020, 12:34:29 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: WebServer stream mjpeg from Webcam  (Read 700 times)
andreag0
RTC Expired
*
Posts: 10


« on: December 10, 2019, 01:12:51 PM »

Hello,
I manage to send jpeg image from webcam but I wish to stream the
realtime video in mjpeg format.
Does anyone know how to do?

Thank you.

Andrea
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1821


« Reply #1 on: December 11, 2019, 09:07:25 AM »

I've never done this, so my answer is purely theoretical (don't ask for details).

Since MJPEG is basically a sequence of stand-alone JPEG images, one way of doing it (once you have the Server-side code that sends a static JPEG from a Webcam) would be to use JavaScript with HTML to implement an event loop inside a Browser, which would keep loading that JPEG from the Server, then painting it on the HTML canvas, or replacing the contents of an image element.

If you need help with HTML and JavaScript, try searching for "MJPEG JavaScript" with www.google.com or www.duckduckgo.com or any another search engine of your choice.

Best Regards,
Danijel Tkalcec
Logged
andreag0
RTC Expired
*
Posts: 10


« Reply #2 on: December 11, 2019, 10:03:43 AM »

Thank you Danijel for support.
About sending image, there is any example how to do in proper way?
I am sending image and in browser I can see correctly but browser is still waiting for some data,
what I am missing except ContentType and ContentLength?

Best Regards
Andrea
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1821


« Reply #3 on: December 11, 2019, 10:11:27 AM »

If Content-Type and Content-Length are both set correctly, you just need to send the image content. That's all.

If the Browser keeps waiting for more data, but the image looks OK, maybe the Content-Length is not correct. Make sure that Content-Length is set to the exact size of the JPEG image you are sending (in bytes).

Best Regards,
Danijel Tkalcec
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.023 seconds with 17 queries.