LEADTOOLS Multimedia (Leadtools.Multimedia assembly)
LEAD Technologies, Inc

EstimateOutputBitRate Method (CaptureCtrl)

Example 





Gets the estimated capture output bit rate, in bits per second.
Syntax
public virtual int EstimateOutputBitRate()
'Declaration
 
Public Overridable Function EstimateOutputBitRate() As Integer
'Usage
 
Dim instance As CaptureCtrl
Dim value As Integer
 
value = instance.EstimateOutputBitRate()
public virtual int EstimateOutputBitRate()
 function Leadtools.Multimedia.CaptureCtrl.EstimateOutputBitRate()
public:
virtual int EstimateOutputBitRate(); 

Return Value

estimated capture output bit rate, in bits per second.
Remarks
The retrieved bit rate depends on the state of the capture object. If the object is in the running state, the retrieved bit rate is related to the actual number of bytes written. If the object is not running, the retrieved bit rate is a theoretical value dependent on the capture settings and the chosen encoder settings.
Example
Copy CodeCopy Code  
Public _result As Boolean = False
      Public _form As CaptureCtrlForm = New CaptureCtrlForm()
      Public _capturectrl As CaptureCtrl
      Public Sub EstimateExample()
         ' reference the capture control
         _capturectrl = _form.CaptureCtrl

         ' output file 
         Dim outFile As String = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_EstimateOutputBitRateExample.avi")

         ' set the video capture device, use your capture device name here
         If _capturectrl.VideoDevices("USB") Is Nothing Then
            Throw New Exception("No USB video device available")
         End If

         _capturectrl.VideoDevices("USB").Selected = True

         Try
            ' set a video compressor
            _capturectrl.VideoCompressors.H264.Selected = True

            ' set the capture target file
            _capturectrl.TargetFile = outFile

            ' set the capture mode to still and start
            _capturectrl.ReadyCapture(CaptureMode.Video Or CaptureMode.InhibitRun)

            ' get the bit rate estimate
            Dim bitRate As Integer = _capturectrl.EstimateOutputBitRate()

            ' get file size estimate for 60 secs
            Dim fileSize As Double = _capturectrl.EstimateOutputSize(60.0)

            ' set the result to what we expect
            _result = (bitRate <> 0 AndAlso fileSize <> 0.0)
         Catch e1 As Exception
            _result = False
         End Try
      End Sub

Public NotInheritable Class LEAD_VARS
   Public Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 175\Media";
End Class
public bool _result = false;
      public CaptureCtrlForm _form = new CaptureCtrlForm();
      public CaptureCtrl _capturectrl;
      public void EstimateExample()
      {
         // reference the capture control
         _capturectrl = _form.CaptureCtrl;

         // output file 
         string outFile = Path.Combine(LEAD_VARS.MediaDir,"CaptureCtrl_EstimateOutputBitRateExample.avi");

         // set the video capture device, use your capture device name here
         if (_capturectrl.VideoDevices["USB"] == null)
            throw new Exception("No USB video device available");

         _capturectrl.VideoDevices["USB"].Selected = true;

         try
         {
            // set a video compressor
            _capturectrl.VideoCompressors.H264.Selected = true;

            // set the capture target file
            _capturectrl.TargetFile = outFile;

            // set the capture mode to still and start
            _capturectrl.ReadyCapture(CaptureMode.Video | CaptureMode.InhibitRun);

            // get the bit rate estimate
            int bitRate = _capturectrl.EstimateOutputBitRate();

            // get file size estimate for 60 secs
            double fileSize = _capturectrl.EstimateOutputSize(60.0);

            // set the result to what we expect
            _result = (bitRate != 0 && fileSize != 0.0);
         }
         catch (Exception)
         {
            _result = false;
         }
      }

static class LEAD_VARS
{
   public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 175\Media";
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

CaptureCtrl Class
CaptureCtrl Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Multimedia requires a Multimedia or Multimedia Suite license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features