VideoEncodeQuality Property

Summary
Gets or sets the video encode quality value of the target format.
Syntax
C#
C++/CLI
public int VideoEncodeQuality { get; set; } 
public: 
property int VideoEncodeQuality { 
   int get(); 
   void set (    int ); 
} 

Property Value

a value representing the video encode quality.

Remarks

this value specifies a number between 0 and 100 that indicates the tradeoff between encoding quality and encoding speed.

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.