Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        public static VideoEncodeCfg GetDefaule(IYUVDraw _Draw = null)
        {
            VideoEncodeCfg encCfg = new VideoEncodeCfg
            {
                VideoBitRate = 256 * 1000,
                FrameRate    = 10,
                Height       = 240,
                Width        = 320,
                CameraId     = 0,
                Draw         = _Draw
            };

            encCfg.SetEncoder("H264");
            return(encCfg);
        }
Ejemplo n.º 3
0
 public ScreenaEncoder(VideoEncodeCfg cfgVideo, Action <MediaFrame> callBack)
     : base(cfgVideo, callBack)
 {
 }
Ejemplo n.º 4
0
 public MixerVideoEncoder(Mixer.Video.Canvas canvas, VideoEncodeCfg cfgVideo, Action <MediaFrame> callBack)
     : base(cfgVideo, callBack, canvas)
 {
     base.Canvas = canvas;
 }