How to Play Transparent background avi file in media element?

眉间皱痕 提交于 2019-11-28 10:55:55

问题


I have a video with transparent background in .avi format (Made from Adobe After Effects), but the transparent background appears black in mediaelement. Media Player has no background property also.

What should i use so that this media element plays the file and when placed on an image takes that image as its background. (No i cannot embed that image in the avi file as my image keeps changing).

*If my approach is wrong please let me know.


回答1:


I'm afraid using the normal wpf media player this can't be done.

The mediaplayer ignores the transparent regions, even with video formats that accept it. From memory, i dont think AVI files support transparent regions. MOV files do.

Having said that, and although it could be a very complicated task, it may be possible to enhance the WPFMediaKit mediaplayer to do what you want.

http://wpfmediakit.codeplex.com/

J Morrill the author of wpfmediakit may be able to let you know if it is possible or not.

I might add that i got around this problem in a project once by using a sequence of .png files that played a short 10 second movie. Of course this is not an ideal solution, but it got me out of a jam




回答2:


Another workaround is to use color keying - assing a color (or more colors) in your video, which you translate to the transparency by a WPF Effect(BitmapEffect or ShaderEffect).



来源:https://stackoverflow.com/questions/8470507/how-to-play-transparent-background-avi-file-in-media-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!