public virtual double EstimateOutputSize(double duration)
Public Overridable Function EstimateOutputSize( _ByVal duration As Double _) As Double
public:virtual double EstimateOutputSize(double duration)
duration
A System.Double that represents the duration, in seconds, used to calculate the estimated output size.
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 dependent on the capturing settings and the chosen encoding settings.
using Leadtools;using Leadtools.MediaFoundation;using LeadtoolsMediaFoundationExamples.Fixtures;public bool _result = false;public CaptureCtrlForm _form = new CaptureCtrlForm();public CaptureCtrl _capturectrl;public void EstimateExample(){// reference the capture control_capturectrl = _form.CaptureCtrl;// output filestring outFile = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_EstimateOutputBitRateExample.avi");// set the video capture device, use your capture device name hereif (_capturectrl.VideoDevices["USB"] == null)throw new Exception("No USB video device available");_capturectrl.VideoDevices["USB"].Selected = true;try{// 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 estimateint bitRate = _capturectrl.EstimateOutputBitRate();// get file size estimate for 60 secsdouble 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:\LEADTOOLS21\Media";}
Imports LeadtoolsImports Leadtools.MediaFoundationImports LeadtoolsMediaFoundationExamples.FixturesPublic _result As Boolean = FalsePublic _form As New CaptureCtrlForm()Public _capturectrl As CaptureCtrlPublic Sub EstimateExample()' reference the capture control_capturectrl = _form.CaptureCtrl' output fileDim outFile As String = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_EstimateOutputBitRateExample.avi")' set the video capture device, use your capture device name hereIf _capturectrl.VideoDevices("USB") Is Nothing ThenThrow New Exception("No USB video device available")End If_capturectrl.VideoDevices("USB").Selected = TrueTry' 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 estimateDim bitRate As Integer = _capturectrl.EstimateOutputBitRate()' get file size estimate for 60 secsDim fileSize As Double = _capturectrl.EstimateOutputSize(60.0)' set the result to what we expect_result = (bitRate <> 0 AndAlso fileSize <> 0.0)Catch generatedExceptionName As Exception_result = FalseEnd TryEnd SubPublic NotInheritable Class LEAD_VARSPublic Const MediaDir As String = "C:\LEADTOOLS21\Media"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
