EstimateOutputSize Method

Summary
Gets the estimated capturing output size for the specified duration, in bytes.
Syntax
C#
C++/CLI
public virtual double EstimateOutputSize( 
   double duration 
) 
public: 
virtual double EstimateOutputSize(  
   double duration 
)  

Parameters

duration
Value that represents the duration to calculate the estimated output size, in seconds.

Return Value

estimated captured object output size, in bytes.

Remarks

The estimated output size is calculated using the following equation: Size = (Bitrate * Duration) / 8. The retrieved size depends on the state of the capture object. If the object is in the running state, the retrieved size is related to the actual number of bytes that have been written. If the object is not running, the retrieved size is a theoretical value that depends on the capture settings and the selected encoding settings.

Example
C#
using Leadtools; 
using Leadtools.Multimedia; 
using LeadtoolsMultimediaExamples.Fixtures; 
 
 
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:\LEADTOOLS22\Media"; 
} 
Requirements

Target Platforms

Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Multimedia Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.