使用canvas來實時播放RTSP視頻

HTML5的標籤能夠用使用下來面的方式來播放靜態視頻node

<video width="320" height="240" controls="controls">
  <source src="movie.ogg" type="video/ogg">
  <source src="movie.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>

但目前桌面版本的chrome,firefox,ie卻沒法播放實時視頻流。但在移動端可使用HLS來播放實時視頻。git

除了Video能夠播放視頻外還可使用canvas來播放視頻。原理是使用websocket來取視頻,而後解碼成圖片,渲染到canvas上。github

在npm上可使用node-rstp-stream來轉碼RTSP視頻流web

github地址:https://github.com/phoboslab/jsmpegchrome

相關文章
相關標籤/搜索