Python Forum

Full Version: Video Streaming
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys, i´m new here, first post. not native speaker.

I came here to ask for opinions.
I have the following project to develop: Play a stream(mjpeg) in the browser and be able to perform the following operations: pause the video, move backwards and forwards.

What i have:
- I have the software that streams the video in mjpeg. It was developed by someone else and cannot be changed. This software provides endpoints(urls)


requirements:
- The player must be in the browser.

Any advices or sugestions?
Quote:requirements:
- The player must be in the browser.

You could use JavaScript: https://videojs.com/guides/embeds/
There are many other existing projects, which do the same.
It's not possible with Python because the Video-Player lives in the DOM, where Python has no access to.
Python could deliver the HTML code with Flask.
Video Js does not support mjpeg =(

For the functions play/pause/forward/backward i need a buffer, so front end? or server side?

I cant find any player who supports mjpeg
Video Js does not support mjpeg smash karts
Then you've to transcode the whole material or find something, which can play mjpeg.

On-The-Fly Transcoding on the server is also possible, but it eats up your CPU/GPU on the server.

Here is a tutorial how to create a stream-server with Flask which uses mjpeg: https://blog.miguelgrinberg.com/post/vid...with-flask
But, this does not include any control. No pause, forward/rewind etc.

I'm not confident how the control of regular Videos in Browser is made, but there must be a mechanism to address a frame-number or a timestamp.
I would not say that this is impossible with mjpeg. I think it's the Range keyword in the Header, which gives the web server the info where to start.

Do you have an online resource of a mjpeg-Video you want to show?