agsh / rtsp-ffmpeg

Node.js FFMpeg wrapper for streaming RTSP into MotionJPEG
MIT License
249 stars 84 forks source link

Html5 video compatibility #13

Open marcoaureliovrs opened 7 years ago

marcoaureliovrs commented 7 years ago

Hello, I'm trying to use your library to run video in a html5 video player

But unfortunately I'm not succeeding, would you have an example of playing videos in html5?

Seikon commented 7 years ago

Hi @marcogorak ,

This library only decodes video in a string of matrix pixels that represent each frame of the video. Obviously you can't target directly these frames to html5 video element because this expect a encoding video format like mp4, ogg... Also, you need another extra information like the fps. I suggest you to take a view of these links that containts libraries usefull for you:

Brodway : https://github.com/mbebenita/Broadway

Images to video Javascript: http://techslides.com/convert-images-to-video-with-javascript

Another solution is to develop a basic video player based in canvas (for more compatibility) that control the time and the fps of the frames string.

Also if you want to tell more about your problem, maybe we could make a solution in this library if more developers have the same problems.

Thank you!

marcoaureliovrs commented 7 years ago

Hi, thanks for the reply.

I wanted to be able to control the pause and play of the stream outside that I would like to buffer the stream in the user's browser because at the moment of execution the frames are being sent in half and being displayed on the screen.

Seikon commented 7 years ago

I think you can start and stop the stream with Socket IO clearing the channel that you are subscribed.

In the example you can disconnect with divSocket.disconnect(); and reconnect with divSocket.connect();