Hardware Acceleration

This topic explains how to enable Intel Graphics, AMD, or NVIDIA hardware acceleration.

For detailed information about the supported hardware platforms, see About Hardware Acceleration.

To enable hardware encoding, on the output MediaPin, set the HardwareEncoder parameter to HardwareEncoder.Auto. This must be done before calling Transcoder.Open:

Example


// create output socket
var outputSocket = MediaSocket.FromPreset(Preset.Video.iPad.H264_720p);

// enable hardware acceleration
var outVideoPin = outputSocket.Pins[0];
outVideoPin.Params.Add(Param.HardwareEncoder, HardwareEncoder.Auto);

Complete C# Example


using PrimoSoftware.AVBlocks;

namespace HardwareEncoding
{
    class Program
    {
        static void Main(string[] args)
        {
            Library.Initialize();

            var inputInfo = new MediaInfo() {
                InputFile = "Wildlife.wmv"
            };

            if (inputInfo.Load()) {

                // create input socket
                var inputSocket = MediaSocket.FromMediaInfo(inputInfo);

                // create output socket
                var outputSocket = MediaSocket.FromPreset(Preset.Video.iPad.H264_720p);

                // enable hardware acceleration
                var outVideoPin = outputSocket.Pins[0];
                outVideoPin.Params.Add(Param.HardwareEncoder, HardwareEncoder.Auto);

                outputSocket.File = "Wildlife.mp4";

                // configure Transcoder and run 
                using (var transcoder = new Transcoder())
                {
                    transcoder.AllowDemoMode = true;

                    transcoder.Inputs.Add(inputSocket);
                    transcoder.Outputs.Add(outputSocket);

                    if (transcoder.Open())
                    {
                        transcoder.Run();
                        transcoder.Close();
                    }
                }
            }

            Library.Shutdown();
        }
    }
}


Last updated on December 5th, 2017 07:32:23 PM