public CameraEncoder(VideoEncodeCfg cfgVideo, Action <MediaFrame> callBack, Canvas canvas = null)
        {
            _cfgVideo   = cfgVideo;
            _fps        = cfgVideo.frameRate;
            this.Canvas = canvas;
            _capturer   = CreateCapturer();
            var @params = new X264Params(_cfgVideo.width, _cfgVideo.height, _fps, cfgVideo.videoBitRate);

            if (cfgVideo.Params.ContainsKey("X264Encode"))
            {
                @params.method = (int)cfgVideo.Params["X264Encode"];
            }

            if (cfgVideo.Params.ContainsKey("KeyFrameRate"))
            {
                @params.key_frame_max = (int)cfgVideo.Params["KeyFrameRate"];
            }


            _x264 = new X264Native(@params);
            _x264.Init();
            _ffscale = new FFScale(_cfgVideo.width, _cfgVideo.height, 0, 12, _cfgVideo.width, _cfgVideo.height, 12, 12);
            _draw    = cfgVideo.Draw;
            _draw.SetSize(_cfgVideo.width, _cfgVideo.height);
            _callBack = callBack;
        }
Example #2
0
        public static VideoEncodeCfg GetDefaule(IYUVDraw _Draw = null)
        {
            VideoEncodeCfg encCfg = new VideoEncodeCfg();

            encCfg.SetEncoder("H264");
            encCfg.videoBitRate = 256 * 1000;
            encCfg.frameRate    = 10;
            encCfg.height       = 240;
            encCfg.width        = 320;
            encCfg.cameraId     = 0;
            encCfg.Draw         = _Draw;
            return(encCfg);
        }
 public ScreenaEncoder(VideoEncodeCfg cfgVideo, Action <MediaFrame> callBack)
     : base(cfgVideo, callBack)
 {
 }
 public MixerVideoEncoder(Mixer.Video.Canvas canvas, VideoEncodeCfg cfgVideo, Action <MediaFrame> callBack)
     : base(cfgVideo, callBack, canvas)
 {
     base.Canvas = canvas;
 }