Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Martin_Vanputten
Beginner
83 Views

C# Directshow H.264 Encoding Parameters

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
83 Views

Hi Marty,
Thanks for contributing to the community.

-Tony
Reply