public void Reset() public:void Reset();
This method will reset the target format properties to their default values. Users typically call this method to remove any values set on the video or audio attributes, also it will reset the container type. If the method fails, an error is raised. For more information, refer to the Error Codes.
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 filesstring 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 formatTargetFormat tf = _convertctrl.TargetFormats[TargetFormatType.MP4];// reset the MP4 target formattf.Reset();// select the MP4 target formattf.Selected = true;// select H264 video formatint index = -1;TargetVideoFormats targetvideoformats = tf.VideoFormats;index = targetvideoformats.IndexOf("{34363248-0000-0010-8000-00AA00389B71}");// H264targetvideoformats.Selection = index;// select AAC audio formatTargetAudioFormats targetaudioformats = tf.AudioFormats;index = targetaudioformats.IndexOf("{00001610-0000-0010-8000-00AA00389B71}");// AACtargetaudioformats.Selection = index;// set audio propertiestf.AudioAvgBytesPerSecond = 24000;tf.AudioBitsPerSample = 16;tf.AudioNumChannels = 2;tf.AudioSamplesPerSecond = 44100;// set video propertiestf.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 completeif (e.percent == 100)_result = true;}static class LEAD_VARS{public const string MediaDir = @"C:\LEADTOOLS23\Media";}
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
