如何在发布流上应用过滤器

时间:2010-12-06 12:12:25

标签: flex flash actionscript-3 recorder

我开发了一个Flash视频录像机(使用AS3,Flex),它可以捕获实时网络摄像头和流到Wowza媒体服务器。

我正在尝试对正在捕捉的实时视频应用锐度,对比度,饱和度和清晰度滤镜。

我可以对屏幕上捕获的视频应用滤镜效果。我们如何应用过滤器以便它反映在正在发布的流中?

提前谢谢你 拉杰什

1 个答案:

答案 0 :(得分:0)

此代码来自用于研究adobe stratus功能的测试应用程序,并重复了skype的基本功能

这是处理类:

public class RecievingObject extends Object
    {        
        public function RecievingObject(){

        }        
        public function message(str: String):void {
            ChatWindow.addText('>> ' + str);
        }
    }

以及它如何附加到流(除了NetStatusEvent处理程序之外的整个类除了什么):

    public final class Streams
    {

        private static var streamOut: NetStream;
        private static var streamIn: NetStream;

        public static function initIn(id: String): void {
            streamIn = new NetStream(Main.connection, id);
            streamIn.client = new RecievingObject();
            streamIn.addEventListener(NetStatusEvent.NET_STATUS, onInStatus);
            streamIn.receiveVideo(true);
            streamIn.receiveAudio(true); 
            streamIn.play('media');
            VideoWindow.initIn(streamIn);
            Mixer.initSound(streamIn);
        }

        public static function initOut(): void {
            streamOut = new NetStream(Main.connection, NetStream.DIRECT_CONNECTIONS);
            var peerConnected:Object = new Object();
                peerConnected.onPeerConnect = function(subscriberStream : NetStream) : Boolean {
                    var oo:RecievingObject = new RecievingObject();
                    subscriberStream.client = oo;
                    if(!streamIn){ initIn((subscriberStream as NetStream).farID); }                    
                    return true;
                }
            streamOut.client = peerConnected;            
            streamOut.addEventListener(NetStatusEvent.NET_STATUS, onOutStatus);            
            streamOut.attachCamera(Camera.getCamera());
            streamOut.attachAudio(Microphone.getMicrophone());
            streamOut.publish('media'); 
        }


        public static function send(data: String): void {
            if(streamOut) { streamOut.send('message', data); }
            ChatWindow.addText('<< ' + data);
        }
   }