Example #1
0
        private void Record_Button_Checked(object sender, RoutedEventArgs e)
        {
            h264Encoder = new H264VideoStreamEncoder();

            string videoName = DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss") + ".mp4";

            //initialize output format&codec
            h264Encoder.OpenOutputURL(videoName, enCodecInfo);

            //start video recode
            activeEncodingThread = true;

            if (isFirstRecord)
            {
                encodingThread.Start();
                isFirstRecord = false;
            }

            pauseEvent.Set();
        }
Example #2
0
        public void RecordVideo(string fileName)
        {
            //isInit = true;
            //if (isInit == false)
            //{
            //    Console.WriteLine("FFmpeg 초기화 필요");
            //    return;
            //}

            isEncodingEvent1 = new ManualResetEvent(false);

            h264Encoder1 = new H264VideoStreamEncoder();

            //initialize output format&codec
            h264Encoder1.OpenOutputURL(fileName, videoInfo1);

            ThreadPool.QueueUserWorkItem(new WaitCallback(EncodeImagesToH264));

            isEncodingEvent1.Set();

            isEncodingThreadRunning1 = true;
            isRecordComplete1        = false;
        }