javascript - Apply filter to HTML5 video without CSS - Stack Overflow

I'm looking for a way to apply some filters to a video (took from webcamera in real time), but wit

I'm looking for a way to apply some filters to a video (took from webcamera in real time), but without using any kind of CSS class.

I do not want to create a CSS class like:

.blur {
   -webkit-filter: blur(1px);
   -moz-filter: blur(1px);
   -o-filter: blur(1px);
   -ms-filter: blur(1px);
   filter: blur(1px);
}

And apply it like document.getElementById("myvideo").className = "blur". No, I'm not looking for this. I need to embed this filter into video so users can quit them. (using injected CSS is not an option).

To clearify myself: I'm not looking for solutions like this .html

Is there any way to do this?

Thanks

EDIT:

I have code like I post before, where I have a CSS class that I assign to my canvas to apply a filter whenever I want

Problem? Users can disable injected CSS using Developer Tools included in Chrome, or using Firebug (by disabling classes, or elements individually).

So I need a solution to apply filters like these, but without injecting CSS into my canvas element.

I'm looking for a way to apply some filters to a video (took from webcamera in real time), but without using any kind of CSS class.

I do not want to create a CSS class like:

.blur {
   -webkit-filter: blur(1px);
   -moz-filter: blur(1px);
   -o-filter: blur(1px);
   -ms-filter: blur(1px);
   filter: blur(1px);
}

And apply it like document.getElementById("myvideo").className = "blur". No, I'm not looking for this. I need to embed this filter into video so users can quit them. (using injected CSS is not an option).

To clearify myself: I'm not looking for solutions like this http://html5-demos.appspot./static/css/filters/index.html

Is there any way to do this?

Thanks

EDIT:

I have code like I post before, where I have a CSS class that I assign to my canvas to apply a filter whenever I want

Problem? Users can disable injected CSS using Developer Tools included in Chrome, or using Firebug (by disabling classes, or elements individually).

So I need a solution to apply filters like these, but without injecting CSS into my canvas element.

Share Improve this question edited Jan 31, 2014 at 17:29 Fran Verona asked Jan 31, 2014 at 17:21 Fran VeronaFran Verona 5,4766 gold badges48 silver badges87 bronze badges 7
  • could you explain a little more about what you mean by "embed this filter into video so users can quit them"? – Dpeif Commented Jan 31, 2014 at 17:25
  • you can do stuff like that in a <canvas>, but it's going to be a CPU hog... – dandavis Commented Jan 31, 2014 at 17:28
  • I edited my own post. (Downvoted? really? why?) – Fran Verona Commented Jan 31, 2014 at 17:29
  • 1 You want a client-side solution that the user can't turn off, ever? That seems unlikely. (Also, why do you need to prevent users from doing that in the first place? So what if they can turn off blurring using some tool?) – Pekka Commented Jan 31, 2014 at 17:33
  • 1 @Dpeif — I think he means "can't". – Quentin Commented Jan 31, 2014 at 17:33
 |  Show 2 more ments

3 Answers 3

Reset to default 4

You have to apply your filters to the video data before delivering it to the browser. There are lots of ways you could do this, for example: ffmpeg supports various filters (including blur).

Anything you can do on the client can be undone by the user (the user controls the client, you don't).

Check out Seriously.js for a huge pile of filters that can target a canvas, video, img or other html element!

If you like to apply filter to a video stream from getUserMedia, you can show the video in a <Canvas> instead of <Video>.

I understand that this is not a very good solution though since it will eat alot of CPU. But you will have few limitations in what filters you can apply.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744812638a4595147.html

相关推荐

  • javascript - Apply filter to HTML5 video without CSS - Stack Overflow

    I'm looking for a way to apply some filters to a video (took from webcamera in real time), but wit

    2天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信