Media (Intel® 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
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

C# Directshow H.264 Encoding Parameters

Martin_Vanputten
Beginner
415 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
415 Views
Hi Marty,
Thanks for contributing to the community.

-Tony
0 Kudos
Reply