예제 #1
0
        private void startScreenCapBtn_Click(object sender, EventArgs e)//开始屏幕录制
        {
            if (savePath == null)
            {
                MessageBox.Show("请先选择文件保存路径!");
                return;
            }
            this.stopScreenCapBtn.Enabled = true;
            f = new Ffmpeg();
            string time = DateTime.Now.ToString();            // 2008-9-4 20:02:10

            if (soundSource != null)
            {
                command = "-f gdigrab -i desktop -f dshow -i audio=" + "\"" + soundSource + "\"" + " -r 5 -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -acodec libmp3lame " + savePath;
                //command = "-f gdigrab -i desktop -f dshow -i audio=" + "\"" + soundSource + "\""+" -r 5 -acodec libmp3lame -f mpegts "+savePath+
            }
            else
            {
                command = "-f gdigrab -i desktop -r 5 -vcodec libx264 -preset:v ultrafast " + savePath;
            }
            //MessageBox.Show(command);
            try
            {
                // f.execute(command);
                f.beginExecute(command);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.ReadLine();
            }
        }
예제 #2
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            string fileName    = Path.Combine(videoPath, DateTime.Now.ToString("HHmmssfff") + ".mpg");
            string url         = "";
            string videoDevice = GetVideoName();

            if (!string.IsNullOrWhiteSpace(videoDevice))
            {
                url = "-f dshow -i video=\"" + videoDevice + "\"";
            }
            else
            {
                throw new Exception("未找到摄像头");
            }

            string mic = GetMicName();

            if (!string.IsNullOrWhiteSpace(mic))
            {
                url += ":audio=\"" + mic + "\" -acodec mp2 -ab 128k";
            }

            string para = string.Format("{0}  -s 1920*1080 -vcodec libx264 -bufsize 2000k {1}", url, fileName);

            para = url + " -r 25 -g 20 -s 1024*768 - vcodec libx264 -x264opts bframes=3:b-adapt=0 -bufsize 2000k -threads 16 -preset:v ultrafast -tune:v zerolatency " + fileName;
            // string para = string.Format("-f gdigrab -i desktop {1} -framerate 6 -g 240 -s 1920*1080 -acodec mp2 -ab 128k -vcodec libx264 -x264opts bframes=3:b-adapt=0 -bufsize 2000k -threads 16 -preset:v ultrafast -tune:v zerolatency {0}", fileName, mic);
            _ffmpeg.beginExecute(para);

            isBegin = true;
        }
예제 #3
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            //  GlobalVariable.client.CreateScreenInteract();



            string fileName = Path.Combine(videoPath, DateTime.Now.ToString("HHmmssfff") + ".mpg");
            string mic      = GetMicName();

            if (!string.IsNullOrWhiteSpace(mic))
            {
                mic = string.Format("-f dshow -i audio=\"{0}\"", mic);
            }
            // fileName = "-f h264 udp://192.168.100.16:6666";
            string para = string.Format("-f gdigrab -i desktop {1}  -s 1920*1080 -vcodec libx264 -bufsize 2000k {0}", fileName, mic);

            // string para = string.Format("-f gdigrab -i desktop {1} -framerate 6 -g 240 -s 1920*1080 -acodec mp2 -ab 128k -vcodec libx264 -x264opts bframes=3:b-adapt=0 -bufsize 2000k -threads 16 -preset:v ultrafast -tune:v zerolatency {0}", fileName, mic);
            _ffmpeg.beginExecute(para);
            isBegin = true;
        }