Recording Screen Activities as a Video Using Microsoft Expression Encoder

Introduction

Here I will explain how to capture screen activities as a video using Microsoft Expression Encoder.

Description

Now I will explain how to capture screen activities as s video using Microsoft Expression Encoder.



Above is the UI for our screen capture application. It consists of the following two field sets:

  1. Screen Recording
  2. Player

Screen Recording consists of one TextBox, a save file dialog and two buttons for starting and stopping the recording.

Use of the screen recording field set is to record the screen capture activities.

The player consists of one TextBox, an open file dialog and a play button.

And also I have embedded the Windows Media Player in our form application.

Use of the player field set is to play the recorded video.

The following method opens the file dialog to save the video:

private void browseSave_Click(object sender, EventArgs e)
{
   folderBrowserDialog1.ShowDialog();
   _savename = folderBrowserDialog1.SelectedPath;
   savetextbox.Text = _savename;
}

After selecting the output path, then click "Stat Recording", the recording will begin as in the following:

private void StrtRecording_Click(object sender, EventArgs e)
{
   _savename = savetextbox.Text;
   _job.OutputPath = _savename;
   label1.Visible = true;
   const string fileName = "ScreenCapture";
   _job.OutputScreenCaptureFileName = _savename + @"\" + fileName + "_" + DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".xesc";
   var audioDevices = EncoderDevices.FindDevices(EncoderDeviceType.Audio);
   for (var deviceCount = 1; deviceCount <= audioDevices.Count; deviceCount++)
   {
      var id = deviceCount - 1;
      _job.AddAudioDeviceSource(audioDevices.ElementAt(id));
   }
   _job.ScreenCaptureVideoProfile = new ScreenCaptureVideoProfile();
   _job.ScreenCaptureVideoProfile.AutoFit = true;
   _job.ScreenCaptureVideoProfile.Quality = 25;
   _job.ScreenCaptureVideoProfile.FrameRate = 12;
   _job.Start();
}

Recording is stopped inside the stop button using the following:

_job.Stop();

For playing the recorded video, first we need to open the video file using the following method:

private void browseOpen_Click(object sender, EventArgs e)
{
   openFileDialog1.Filter = Resources.Form1_Browse_Click_xesc___xesc;
   openFileDialog1.ShowDialog();
   _openname = openFileDialog1.FileName;
   openTextbox.Text = _openname;
}

After selecting the video, then clicking the Play button, the functionality of the Play button will be as folows:

private void Play_Click(object sender, EventArgs e)
{
   openTextbox.Text = _openname;
   axWindowsMediaPlayer1.URL = _openname;
   axWindowsMediaPlayer1.Show();


Similar Articles