VideoFormats Property

Summary
Gets the target video formats collection object.
Syntax
C#
C++/CLI
public TargetVideoFormats VideoFormats { get; } 
public: 
property TargetVideoFormats^ VideoFormats { 
   TargetVideoFormats^ get(); 
} 

Property Value

An TargetVideoFormats object representing the target video format collection.

Remarks

The TargetVideoFormats object is used to build a list of target video formats to use in the target format object and determine which video formats are supported by the target format.

Example
C#
using Leadtools; 
using Leadtools.MediaFoundation; 
using LeadtoolsMediaFoundationExamples.Fixtures; 
 
 
public bool _result = false; 
public ConvertCtrlForm _form = new ConvertCtrlForm(); 
public ConvertCtrl _convertctrl; 
 
public void VideoFormatsExample() 
{ 
   // reference the convert control 
   _convertctrl = _form.ConvertCtrl; 
 
   // input and output files 
   string inFile = Path.Combine(LEAD_VARS.MediaDir, "ConvertCtrl_Source.avi"); 
   string outFile = Path.Combine(LEAD_VARS.MediaDir, "ConvertCtrl_VideoFormatsExample.MP4"); 
 
   try 
   { 
      // set the source for conversion 
      _convertctrl.SourceFile = inFile; 
 
      // get the MP4 target format 
      TargetFormat tf = _convertctrl.TargetFormats[TargetFormatType.MP4]; 
 
      // reset the MP4 target format 
      tf.Reset(); 
 
      // select the MP4 target format 
      tf.Selected = true; 
 
      // select H264 video format 
      int index = -1; 
      TargetVideoFormats targetvideoformats = tf.VideoFormats; 
      index = targetvideoformats.IndexOf("{34363248-0000-0010-8000-00AA00389B71}");// H264 
      targetvideoformats.Selection = index; 
 
      // select AAC audio format 
      TargetAudioFormats targetaudioformats = tf.AudioFormats; 
      index = targetaudioformats.IndexOf("{00001610-0000-0010-8000-00AA00389B71}");// AAC 
      targetaudioformats.Selection = index; 
 
      // set audio properties 
      tf.AudioAvgBytesPerSecond = 24000; 
      tf.AudioBitsPerSample = 16; 
      tf.AudioNumChannels = 2; 
      tf.AudioSamplesPerSecond = 44100; 
 
      // set video properties 
      tf.VideoEncodeQuality = 85; 
      tf.VideoFrameHeight = 240; 
      tf.VideoFrameRate = 29.26; 
      tf.VideoFrameWidth = 320; 
      tf.VideoBitrate = 700000; 
 
      // set the target output file and format 
      _convertctrl.TargetFile = outFile; 
 
      // set our progress event handler 
      _convertctrl.Progress += new ProgressEventHandler(ConvertCtrl_Progress); 
 
      // convert it now! 
      _convertctrl.StartConvert(); 
   } 
   catch (Exception) 
   { 
      _result = false; 
   } 
 
   // we'll loop on the state and pump messages for this example. 
   // but you should not need to if running from a Windows Forms application. 
   while (_convertctrl.State == ConvertState.Running) 
      Application.DoEvents(); 
} 
 
void ConvertCtrl_Progress(object sender, ProgressEventArgs e) 
{ 
   // set the result to true if complete 
   if (e.percent == 100) 
      _result = true; 
} 
 
static class LEAD_VARS 
{ 
   public const string MediaDir = @"C:\LEADTOOLS23\Media"; 
} 
Requirements

Target Platforms

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

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