简体   繁体   English

使用HTML5对视频流进行像素化处理

[英]Pixelate video stream with HTML5

I'm goofing around with some HTML5 stuff and wanted to combine the Close Pixelate library with the getUserMedia API . 我正在讨论一些HTML5的东西,并希望将Close Pixelate库与getUserMedia API结合起来。 I want to pixelate the stream on the fly (i get the frame rate would be crazy low). 我想在运行中像素化流(我得到的帧速率将是疯狂的低)。 Is this at all possible? 这是可能吗? I would like to just give Close Pixelate the video-object instead of the image. 我想给视频对象而不是图像提供关闭像素。

This video by Rob Hawkes gave me the idea. Rob Hawkes的这段视频给了我这个想法。

Solution: http://jsfiddle.net/N46QF/ (you need Google Chrome Canary with MediaStream activated in chrome://flags/ to get it to work) 解决方案: http//jsfiddle.net/N46QF/ (您需要在Chrome:// flags /中激活MediaStream的Google Chrome Canary才能使其正常工作)

Yes I think this is possible. 是的我认为这是可能的。 However, in order to manipulate the frames of the video at a pixel level, you'll need to draw them onto a canvas first using an interval (see fiddle , tested in firefox and chrome). 但是,为了在像素级别操纵视频的帧,您需要首先使用间隔将它们绘制到画布上(请参阅小提琴 ,在firefox和chrome中测试)。

Since the Close Pixelate library expects an image as input (which it immediately draws to a canvas anyway), you'll need to amend the code slightly so that you can pass in your canvas directly. 由于Close Pixelate库需要将图像作为输入(无论如何它都会立即绘制到画布上),因此您需要稍微修改代码,以便可以直接传入画布。

Whether the library will stand up to repeated instantiation on an interval or your frame rate will be acceptable I don't know but think it should be easy enough to test. 图书馆是否会经受一段时间的重复实例化或你的帧速率是可以接受的我不知道,但认为它应该很容易测试。 I'll certainly be interested to see the results! 我当然有兴趣看到结果!

If it all works out it might be worth considering forking the Close Pixelate library and amending it to allow either an image or a canvas as the input since this would appear to be a useful extension. 如果一切顺利,可能值得考虑分支关闭Pixelate库并修改它以允许图像或画布作为输入,因为这似乎是一个有用的扩展。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM