Gets the estimated capturing output size for the specified duration, in bytes.
public virtual double EstimateOutputSize(
double duration
)
Public Overridable Function EstimateOutputSize( _
ByVal duration As Double _
) As Double
public:
virtual double EstimateOutputSize(
double duration
)
duration
Value that represents the duration to calculate the estimated output size, in seconds.
estimated captured object output size, in bytes.
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.
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:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media";
}
Imports Leadtools
Imports Leadtools.Multimedia
Imports LeadtoolsMultimediaExamples.Fixtures
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 seconds
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 19\Media"
End Class
Products |
Support |
Feedback: EstimateOutputSize Method (CaptureCtrl) - Leadtools.Multimedia |
Introduction |
Help Version 19.0.2017.6.16
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.