在html5中渲染MJpeg流 [英] Rendering MJpeg stream in html5

查看:1005
本文介绍了在html5中渲染MJpeg流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用img标记在HTML5中呈现MJpeg流。
当我运行以下内容时,一切正常,视频开始播放直到视频结束:

 < img src =http:// [some ip]:[port] / mjpg> 

我的问题是如何逐帧获取流帧。
对于每一帧,我都希望得到它,做一些事情(ajax调用服务器),然后将该帧显示为图像。



谢谢。 / p> frame / XXX),那么你可以在服务器上使用MJPEG流解析器。例如, Paparazzo.js 解析流并返回单个jpeg。实际上它只返回最后一帧而不保存以前的内容,但它可以被修改。



问题不能仅在js没有插件和服务器的浏览器中解决。

p>

I'm trying to render MJpeg stream in HTML5 using the img tag. When I'm running the following, everything works great, meaning, the video starts to play until the video ends:

<img src="http://[some ip]:[port]/mjpg">

My question is how can I get the stream frame by frame. For each frame, I want to get it, do something (ajax call to the server) and then display the frame as an image.

Thanks.

解决方案

If you stream source can't return frames on another address (http://[some ip]:[port]/frame/XXX) then you can use MJPEG stream parser on the server. For example, Paparazzo.js parse stream and return single jpeg. Actually it returns only last frame without saving previous, but it can be changed.

Problem can't be solved only in browser with js without some plugins and server.

这篇关于在html5中渲染MJpeg流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆