Can I have a video with transparent background usi

2019-01-07 07:55发布

We filmed a spokesperson on a green screen and have the video files ready in multiple formats.

With Flash we could use the wmode transparent within the param and embed tags, but is there something similar to this with the video and source tags in HTML5? Is it even possible to properly save .m4v or .ogv videos so that we can play these files with transparent backgrounds on our browsers?

Thanks

8条回答
乱世女痞
2楼-- · 2019-01-07 08:06

No. This is a limitation of the video codecs supported by the browsers: mp4, ogv, and webm do not currently support alpha channels.

There are workarounds, but they involve re-rendering the video using Canvas and it is kind of a hack. seeThru is one example. It works pretty well on HTML5 desktop browsers (even IE9) but it doesn't seem to work very well on mobile. I couldn't get it to work at all on Chrome for Android. It did work on Firefox for Android but with a pretty lousy framerate. I think you might be out of luck for mobile, although I'd love to be proven wrong.

查看更多
老娘就宠你
3楼-- · 2019-01-07 08:14

Yes, this sort of thing is possible without Flash:

However, only very modern browsers supports HTML5 videos, and this should be your consideration when deploying in HTML 5, and you should provide a fallback (probably Flash or just omit the transparency).

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-01-07 08:22

Mp4 files can be playable with transparent background using seeThrou Js library. All you need to combine actual video and alpha channel in the single video. Also make sure to keep video height dimension below 1400 px as some of the old iphone devices wont play videos with dimension more than 2000. This is pretty useful in safari desktop and mobile devices which doesnt support webm at this time.

more details can be found in the below link https://github.com/m90/seeThru

查看更多
祖国的老花朵
5楼-- · 2019-01-07 08:23

Quicktime movs exported as animation work but in safari only. I wish there was a complete solution (or format) that covered all major browsers.

查看更多
疯言疯语
6楼-- · 2019-01-07 08:25
叛逆
7楼-- · 2019-01-07 08:25

While this isn't possible with the video itself, you could use a canvas to draw the frames of the video except for pixels in a color range or whatever. It would take some javascript and such of course. See Video Puzzle (apparently broken at the moment), Exploding Video, and Realtime Video -> ASCII

查看更多
登录 后发表回答