ByteScout Screen Capturing SDK - VB.NET - Video Quality Profiles - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout Screen Capturing SDK – VB.NET – Video Quality Profiles

  • Home
  • /
  • Articles
  • /
  • ByteScout Screen Capturing SDK – VB.NET – Video Quality Profiles

ByteScout Screen Capturing SDK – VB.NET – Video Quality Profiles

Form1.vb

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
Imports BytescoutScreenCapturingLib
 
Public Class Form1
 
#Region "Fields"
 
    Private _capturer As BytescoutScreenCapturingLib.Capturer
    Private _converting As Boolean = False
    Private _paused As Boolean = False
 
#End Region
 
    ''' <summary>
    ''' Form load event handler
    ''' </summary>
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            _cmbQuality.DataSource = [Enum].GetValues(GetType(VideoQualityProfileType))
            _cmbQuality.SelectedIndex = 0
 
            _capturer = New BytescoutScreenCapturingLib.Capturer()
            _capturer.RegistrationName = "demo"
            _capturer.RegistrationKey = "demo"
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
 
    ''' <summary>
    ''' Handle screen capture button click
    ''' </summary>
    Private Sub _btnScreenCapture_Click(sender As Object, e As EventArgs) Handles _btnScreenCapture.Click
        Try
 
            If _converting Then
 
                If _capturer.IsRunning Then
                    _capturer.[Stop]()
                End If
 
                StopCapturer()
 
                _btnPauseScreenCapture.Visible = False
 
            Else
 
                _capturer.OutputWidth = CInt(_numWidth.Value)
                _capturer.OutputHeight = CInt(_numHeight.Value)
                _capturer.FPS = CSng(_numFramerate.Value)
 
                _capturer.SetVideoQualityProfile(CType(_cmbQuality.SelectedItem, BytescoutScreenCapturingLib.VideoQualityProfileType))
 
                _lblBitrate.Text = String.Format("Bitrate: {0}[kbps], Wmv Quality: {1}, MinQuantizer: {2}, MaxQuantizer: {3}", _capturer.WMVVideoBitrate / 1000, _capturer.WmvVideoQuality, _capturer.WebmMinQuantizer, _capturer.WebmMaxQuantizer)
 
                _capturer.AnimateMouseClicks = True
                _capturer.AnimateMouseButtons = True
                _capturer.CapturingType = BytescoutScreenCapturingLib.CaptureAreaType.catScreen
 
                _capturer.OutputFileName = _txtOutputFile.Text
 
                _capturer.EncoderThreadsCount = CInt(_numEncodingThreads.Value)
 
                _capturer.AudioEnabled = False
 
                _capturer.Run()
 
                _converting = True
                _btnScreenCapture.Text = "Stop screen capture"
 
                _btnPauseScreenCapture.Visible = True
                _paused = False
 
            End If
 
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
 
    Private Sub _btnPauseScreenCapture_Click(sender As Object, e As EventArgs) Handles _btnPauseScreenCapture.Click
        If _paused Then
            _capturer.Run()
            _btnPauseScreenCapture.Text = "Pause Screen Capture"
            _paused = False
        Else
            _capturer.Pause()
            _btnPauseScreenCapture.Text = "Resume Screen Capture"
            _paused = True
        End If
    End Sub
 
    Private Sub StopCapturer()
        _converting = False
        _btnScreenCapture.Text = "Screen capture video"
 
        Process.Start(_txtOutputFile.Text)
    End Sub
 
End Class

  Click here to get your Free Trial version of the SDK

Tutorials:

prev
next