捕获视频帧然后导出为 HTML5 中的位图
我有一个可以播放视频的网络应用程序。
我正在考虑使用 HTML5 元素,并确定它可以满足我的所有要求,除了以下一项:允许用户拍摄当前视频帧的快照,并且将其保存为光栅图像格式(即JPG)。
对于这个要求,我还没有找到解决方案,并且对此事的任何指导将不胜感激。
为了帮助回答这个问题,这里有更多细节。我将通过 HTTP 从服务器下载视频文件,然后在浏览器中播放它们。这不是视频流,而是下载并在收到文件后开始播放。视频将采用 MP4 格式。
该解决方案只需要在 IE 9 中运行。(尽管我自然希望该解决方案尽可能跨浏览器/平台。)
I have a web application where I play back video.
I am considering using the HTML5 <video>
element and have determined it will allow me to meet all of my requirements except one: allowing the user to take a snapshot of the current video frame and save it as a raster image format (i.e. JPG).
For this requirement I have not found a solution, and any guidance on this matter would be greatly appreciated.
To help answer the question here are more details. I will download the video files from a server via HTTP and then play them back in the browser. This will not be a video stream, but instead a download with playback starting after the file has been received. The video will be in the MP4 format.
The solution only needs to run in IE 9. (Although naturally I would like the solution to be as cross-browser/platform as possible.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将图像捕获到
canvas
元素:然后使用
toDataURL()
方法获取图像:请注意,要使所有这些工作视频必须来自同一视频原点为页面。
Capture the image to a
canvas
element:Then use the
toDataURL()
method to get the image:Be aware that for all this to work the video has to be from the same origin as the page.