Media (Intel® oneAPI Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK

C# Directshow H.264 Encoding Parameters

Martin_Vanputten
Beginner
302 Views
This is for anyone who is developing in c# directshow using the h264 encoder provided by intel.

The parameters used to set the quality of the encoder can be very annoying as I get really wacky results.

Instead of writing a thousand lines of code to create the parameter structures you can literally do this in about 12 lines of code. Here goes:

RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\\Intel\\Media SDK Sample Filters\\H264 Encoder", true);

key.SetValue("Level", 40);

key.SetValue("RCControl.bitrate", 21000);

key.SetValue("PCControl", 1);

key.SetValue("Preset", 0);

key.SetValue("Profile", 100);

key.SetValue("PSControl.GopPicSize", 200);

key.SetValue("PSControl.GopRefDist", 3);

key.SetValue("PSControl.NumSlice", 1);

key.SetValue("RCControl.rc_method", 1);

key.SetValue("TargetUsage", 4);

key.Dispose();

Everything is stored in the registry and as long as you set these values before creating the encoder object then the encoder will use these settings.

Much more convenient!

Cheers,
Marty

0 Kudos
1 Reply
Anthony_P_Intel
Employee
302 Views
Hi Marty,
Thanks for contributing to the community.

-Tony
0 Kudos
Reply