1

I have mjpeg stream (generated by ffserver) and I consume this stream as image, like this:

<img src='http://localhost:8090/live.mjpg'>

Basically I can see video within img tag, however it is still an image for a browser -- I don't get any controls like stop/play.

Thus my question, is it possible to consume this stream via video tag to get the controls? I tried it (in Chrome) and I get empty controls box (no video content).

I am not looking for cross-browser ancient compatibility, I am looking for consuming mjpeg video stream as video, not as animated image.

astrowalker
  • 3,123
  • 3
  • 21
  • 40
  • Possible duplicate of [Cross-browser solution for displaying MJPEG stream](https://stackoverflow.com/a/12966492/2710385) – dylan-myers May 11 '18 at 10:42
  • @dylmye, thank you, but not even close, the other post is 7 years old and struggles with browser compability. This is not my problem, my problem is with `video` tag in order to get controls (this was out of scope of the linked question). – astrowalker May 11 '18 at 10:50
  • glad I could help with my answer but in terms of duplicates is this closer? [mjpeg HTML5 video doesn't stream with – dylan-myers May 11 '18 at 10:55
  • @dylmye, yes, indeed. – astrowalker May 11 '18 at 11:11

1 Answers1

2

The <video> tag only supports the following mimetypes:

  • video/webm
  • video/ogg
  • video/mp4 (firefox only?)

(source: MDN)

so you would need to convert the mjpg (video/x-motion-jpeg) to one of these. You might want to use a proxy server.

dylan-myers
  • 323
  • 3
  • 18