Example #1
0
        //public void BeginRecordVideo(string filename)
        //{

        //    var video = GetVideoName();
        //    if (string.IsNullOrWhiteSpace(video))
        //    {
        //        throw new Exception("未找到摄像头");
        //    }
        //    var url = "-f dshow -i video=\"" + video + "\"";
        //    var mic = GetMicName();
        //    if (!string.IsNullOrWhiteSpace(mic))
        //    {
        //        url += ":audio=\"" + mic + "\" -acodec mp2 -ab 128k";
        //    }
        //    url += CreateFFmpegVideoRecordParam() + filename;
        //    Loger.LogMessage("录制视频命令:" + url);
        //    this._ffmpeg = new Ffmpeg();
        //    this._ffmpeg.beginExecute(url);
        //    _ffmpeg.WaitComplete();
        //}

        public void BeginRecordScreen(string filename)
        {

            var url = "-f gdigrab -i desktop ";
            var mic = GetMicName();
            if (!string.IsNullOrWhiteSpace(mic))
            {
                url += " -f dshow -i audio=\"" + mic + "\" -acodec mp2 -ab 128k";
            }
            url += CreateFFmpegVideoRecordParam(true) + filename;
            Loger.LogMessage("录制视频命令:" + url);
            this._ffmpeg = new Ffmpeg();
            this._ffmpeg.beginExecute(url);
            _ffmpeg.WaitComplete();
        }
Example #2
0
 private string pushRtspStream(string ipServer, string ipSelf, int portSelf)
 {
     var para = GetFFMpegParaAndUrl(ipServer, ipSelf, portSelf);
     var mic = GetMicName();
     var url = "-f gdigrab -i desktop ";
     if (!string.IsNullOrWhiteSpace(mic))
         url += " -f dshow -i audio=\"" + mic + "\" -acodec mp2 -ab 128k";
     url += para[1];
     Loger.LogMessage("视频命令:" + url);
     this._ffmpeg = new Ffmpeg();
     //  this._ffmpeg.MessageReceived += _ffmpeg_MessageReceived;
     this._ffmpeg.beginExecute(url);
     _ffmpeg.WaitComplete();
     // var rtsp = "rtsp://" + ipServer + "/" + nameByIpPort + ".sdp";
     return para[0];
 }
Example #3
0
 private string pushVideoByFFmpeg(string ipServer, string ipSelf, int portSelf)
 {
     var para = GetFFMpegParaAndUrl(ipServer, ipSelf, portSelf);
     var video = GetVideoName();
     if (string.IsNullOrWhiteSpace(video))
     {
         throw new Exception("未找到摄像头");
     }
     var url = "-f dshow -i video=\"" + video + "\"";
     var mic = GetMicName();
     if (!string.IsNullOrWhiteSpace(mic))
     {
         url += ":audio=\"" + mic + "\" -acodec mp2 -ab 128k";
     }
     url += para[1];
     Loger.LogMessage("视频命令:" + url);
     this._ffmpeg = new Ffmpeg();
     this._ffmpeg.beginExecute(url);
     _ffmpeg.WaitComplete();
     return para[0];
 }