[RED 5] Prob quality audio microphone

  • kosmos17
  • Born
  • Born
  • kosmos17
  • Posts: 1

Post 3+ Months Ago

Hello,
Jutilise RED5 to broadcast my live webcam but laudio is just rotten
It is intermittent and of poor sound quality.
I put my 2 scripts using the mailing of my live cam.

My config is good because she tried jai daméliorer quality video and laudio?

The 1st is to publish it.
Code: [ Select ]
public class CameraBroadcast{
        private var cam : Camera;
        private var nc : NetConnection;
        private var ns : NetStream;
        private var mic:Microphone;
        private var monUrl : URLRequest;
        
        public var expediteur :String;
        public var code :String;
        
        public function CameraBroadcast(){
            //Constructeur
        }

        public function initNC() : void {
            // Pour indiquer au serveur qui doit être le client (peut être tout objet ActionScript)
            nc = new NetConnection();
            nc.client = this;
            // Red5 ne supporte que AMF0
            nc.objectEncoding = ObjectEncoding.AMF0;
            // Connection au serveur Red5 sur le port RTMP 1935
            nc.connect("rtmp://xxxxxxxxxxxxxxxxxxxx");
            // On écoute les évènements de la couche transport
            nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
            nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
        }

        private function netStatusHandler (event : NetStatusEvent) : void{
            switch (event******.code){
                case "NetConnection.Connect.Success": {
                    this.cam = Camera.getCamera();
                    this.ns = new NetStream (nc);
                    
                    //-------- PARAMETRES MICROPHONE --------------
                    this.mic = Microphone.getMicrophone();
                    //Supprime le probleme ECHO
                    this.mic.setUseEchoSuppression(true);
                    //Améliore la diffusion du son entre chaque utilisation temps en millisecondes
                    this.mic.setSilenceLevel(10,1000);
                    
                    //--------- PARAMETRES CAMERA -----------------
                    //Améliore la qualité de l'image
                    this.cam.setQuality(40000,80);
                    //Améliore la capture de l'image
                    this.cam.setMotionLevel(30,500);
                    //Definir les dimensions de la cam diffusée
                    this.cam.setMode(407,307,25,true);
                    
                    this.ns.attachCamera(this.cam);
                    this.ns.attachAudio(this.mic);
                    
                    try{
                        this.ns.client = this;
                        this.ns.publish(this.expediteur,"live");
                    }
                    catch (e:Error) {
                        trace (e.message);
                    }
                    break; 
                }
                default:
                alert.show("Attention...Assurez-vous que votre webcam soit branchée !");
                break;
            }
        }
        
        public function onBWDone():void {
            // Appelé par RED5 au moment de la connexion
        }
                
        public function onMetaData (data : Object) : void{
            // Appelé par RED5 au moment de la connexion
        }
    
        public function onPlayStatus (data : Object) : void   {
            // Appelé par RED5 au moment de la connexion
        }
        
        public function asyncErrorHandler(event:AsyncErrorEvent):void {
            // Appelé par RED5 au moment de la connexion
        }
        
        public function stopperCamera():void{
            this.ns.close();
            this.monUrl = new URLRequest("http://xxxxxxxxxxxxxx/index.php?do=maj&cs="+this.code);
            navigateToURL(this.monUrl,"_self");
        }
    }
  1. public class CameraBroadcast{
  2.         private var cam : Camera;
  3.         private var nc : NetConnection;
  4.         private var ns : NetStream;
  5.         private var mic:Microphone;
  6.         private var monUrl : URLRequest;
  7.         
  8.         public var expediteur :String;
  9.         public var code :String;
  10.         
  11.         public function CameraBroadcast(){
  12.             //Constructeur
  13.         }
  14.         public function initNC() : void {
  15.             // Pour indiquer au serveur qui doit être le client (peut être tout objet ActionScript)
  16.             nc = new NetConnection();
  17.             nc.client = this;
  18.             // Red5 ne supporte que AMF0
  19.             nc.objectEncoding = ObjectEncoding.AMF0;
  20.             // Connection au serveur Red5 sur le port RTMP 1935
  21.             nc.connect("rtmp://xxxxxxxxxxxxxxxxxxxx");
  22.             // On écoute les évènements de la couche transport
  23.             nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
  24.             nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
  25.         }
  26.         private function netStatusHandler (event : NetStatusEvent) : void{
  27.             switch (event******.code){
  28.                 case "NetConnection.Connect.Success": {
  29.                     this.cam = Camera.getCamera();
  30.                     this.ns = new NetStream (nc);
  31.                     
  32.                     //-------- PARAMETRES MICROPHONE --------------
  33.                     this.mic = Microphone.getMicrophone();
  34.                     //Supprime le probleme ECHO
  35.                     this.mic.setUseEchoSuppression(true);
  36.                     //Améliore la diffusion du son entre chaque utilisation temps en millisecondes
  37.                     this.mic.setSilenceLevel(10,1000);
  38.                     
  39.                     //--------- PARAMETRES CAMERA -----------------
  40.                     //Améliore la qualité de l'image
  41.                     this.cam.setQuality(40000,80);
  42.                     //Améliore la capture de l'image
  43.                     this.cam.setMotionLevel(30,500);
  44.                     //Definir les dimensions de la cam diffusée
  45.                     this.cam.setMode(407,307,25,true);
  46.                     
  47.                     this.ns.attachCamera(this.cam);
  48.                     this.ns.attachAudio(this.mic);
  49.                     
  50.                     try{
  51.                         this.ns.client = this;
  52.                         this.ns.publish(this.expediteur,"live");
  53.                     }
  54.                     catch (e:Error) {
  55.                         trace (e.message);
  56.                     }
  57.                     break; 
  58.                 }
  59.                 default:
  60.                 alert.show("Attention...Assurez-vous que votre webcam soit branchée !");
  61.                 break;
  62.             }
  63.         }
  64.         
  65.         public function onBWDone():void {
  66.             // Appelé par RED5 au moment de la connexion
  67.         }
  68.                 
  69.         public function onMetaData (data : Object) : void{
  70.             // Appelé par RED5 au moment de la connexion
  71.         }
  72.     
  73.         public function onPlayStatus (data : Object) : void   {
  74.             // Appelé par RED5 au moment de la connexion
  75.         }
  76.         
  77.         public function asyncErrorHandler(event:AsyncErrorEvent):void {
  78.             // Appelé par RED5 au moment de la connexion
  79.         }
  80.         
  81.         public function stopperCamera():void{
  82.             this.ns.close();
  83.             this.monUrl = new URLRequest("http://xxxxxxxxxxxxxx/index.php?do=maj&cs="+this.code);
  84.             navigateToURL(this.monUrl,"_self");
  85.         }
  86.     }


The 2nd to read.
Code: [ Select ]
public function initNC () : void{
                // Pour indiquer au serveur qui doit être le client (peut être tout objet ActionScript)
                nc = new NetConnection();
                nc.client = this;
                // Red5 ne supporte que AMF0
                nc.objectEncoding = ObjectEncoding.AMF0;
                // Connection au serveur Red5 sur le port RTMP 1935
                nc.connect("rtmp://xxxxxxxxxxxxxxxxxxxxxxxxxxx");
                // On écoute les évènements de la couche transport
                nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
            }
            
            private function netStatusHandler (event : NetStatusEvent) : void{
                switch (event******.code){
                    case "NetConnection.Connect.Success": {
                        this.ns = new NetStream(nc);
                        this.video = new Video();
                        this.video.attachNetStream(this.ns);
                        this.video.width = 407;
                        this.video.height = 307;
                        slr.addChild(this.video);
                        try{
                            this.ns.client = this;
                            this.ns.play(this.destinataire);
                        }
                        catch (e:Error) {
                            trace (e.message);
                        }
                        break; 
                    }
                    default:
                    break;
                }
            }

            public function onBWDone():void {
                // Appelé par RED5 au moment de la connexion
            }
                
            public function onMetaData (data : Object) : void{
                // Appelé par RED5 au moment de la connexion
            }
    
            public function onPlayStatus (data : Object) : void   {
                // Appelé par RED5 au moment de la connexion
            }
            public function asyncErrorHandler(event:AsyncErrorEvent):void {
                // Appelé par RED5 au moment de la connexion
            }
  1. public function initNC () : void{
  2.                 // Pour indiquer au serveur qui doit être le client (peut être tout objet ActionScript)
  3.                 nc = new NetConnection();
  4.                 nc.client = this;
  5.                 // Red5 ne supporte que AMF0
  6.                 nc.objectEncoding = ObjectEncoding.AMF0;
  7.                 // Connection au serveur Red5 sur le port RTMP 1935
  8.                 nc.connect("rtmp://xxxxxxxxxxxxxxxxxxxxxxxxxxx");
  9.                 // On écoute les évènements de la couche transport
  10.                 nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
  11.                 nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
  12.             }
  13.             
  14.             private function netStatusHandler (event : NetStatusEvent) : void{
  15.                 switch (event******.code){
  16.                     case "NetConnection.Connect.Success": {
  17.                         this.ns = new NetStream(nc);
  18.                         this.video = new Video();
  19.                         this.video.attachNetStream(this.ns);
  20.                         this.video.width = 407;
  21.                         this.video.height = 307;
  22.                         slr.addChild(this.video);
  23.                         try{
  24.                             this.ns.client = this;
  25.                             this.ns.play(this.destinataire);
  26.                         }
  27.                         catch (e:Error) {
  28.                             trace (e.message);
  29.                         }
  30.                         break; 
  31.                     }
  32.                     default:
  33.                     break;
  34.                 }
  35.             }
  36.             public function onBWDone():void {
  37.                 // Appelé par RED5 au moment de la connexion
  38.             }
  39.                 
  40.             public function onMetaData (data : Object) : void{
  41.                 // Appelé par RED5 au moment de la connexion
  42.             }
  43.     
  44.             public function onPlayStatus (data : Object) : void   {
  45.                 // Appelé par RED5 au moment de la connexion
  46.             }
  47.             public function asyncErrorHandler(event:AsyncErrorEvent):void {
  48.                 // Appelé par RED5 au moment de la connexion
  49.             }


Thank you for your help ;)
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 10 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.