Presets store configuration for derivation. There can be more active presets in a system at the same time. To create a preset from code, one should first implement CTools hook_ctools_plugin_api(). This example should work for 95% of use cases:

function hook_ctools_plugin_api($owner, $api) {
  if ($owner == 'media_derivatives'&& $api == 'media_derivatives_presets') {
    return array('version' => 1);
  }
}

hook_media_derivatives_presets() should be implemented to actually create one or more configuration presets. Function should return an array with preset objects as it's items. Here is an example of exported presetMedia HTML5 video feature (preset + formatter). There is also API reference availible.