- Conversion profiles are under heavy development.
- Next release will include a set of APIs to define the various conversion profiles and create new ones.
- Next release will also be shipped with new GUI in the KMC to allow management of conversion profiles.
Introduction
The H264 codec provides good video quality at low bit rate, making it very popular for video streaming. If you plan to stream high quality videos, it's a must have. So here's a guide to enable this codec in Kaltura CE.
Conversion Profile: Database
The default encoder of Kaltura CE is ffmpeg. Since the ffmpeg within Kaltura is built with h264 support, we don't have anything to change at this level, all we have to do is to configure it in the conversion parameters.
Let's take a look at our Kaltura CE database. There's a table named conversion_params. This table contains all the encoding profiles and their settings.
What's left to be done is to pick the one we want to use and start editing its parameters.

Conversion Profile: setting encoding parameters
We can set a custom bit rate and gop size (number of keyframes per frames) in those fields, but the field that really concerns us is custom_data. custom_data is a php serialized object that contains the additional parameters that will be passed to the encoding engines (ffmpeg in this case) when the transcoding is done.
The default value of custom_data is the following:
s:9:"framerate";s:2:"25";s:13:"audioChannels";i:2;s:17:"audioSamplingRate";i:22050;}
custom_data Explained
{<type>:<length>:<parameter name>;<type>:<length>:<parameter value>;} and so on to the last parameter.
In this example, there are two types of parameters:
- "s" - String typed parameter. (Length is only set for strings)
- "i" - Integer typed parameter.
ffmpeg specific parameters inside custom_data
The parameter we want to change is "ffmpegParams". In the default setting is set to no specific parameters.
enabling ffmpeg's h264 codec
To enable the ffmpeg's h264 codec, the following parameter must be set:
-vcodec libx264.
Then to customize the encoding for high quality conversion, the hq preset is set:
-vpre /home/kaltura/libx264-hq.ffpreset.
ffmpeg presets are files that contain predefined set of parameters and values that come with ffmpeg (or can be created/downloaded) and are used to carry specialized conversion tasks (such as highquality, etc).
Note: You will need to define the path to where the preset is located on the disk (e.g. /home/kaltura/libx264-hq.ffpreset).
To utilize the cpu cores in the most effective way for the h264 compression set the following parameter: -threads 0.
Final conversion profile
The following is the full ffmpeg conversion profile you should end up with (if you set the parameters mentioned):
s:12:"ffmpegParams";s:66:"-vcodec libx264 -vpre /home/kaltura/libx264-hq.ffpreset -threads 0"
Note: Don't forget to update string length each time you edit a parameter!
Saving the changes
Update your conversion_params table in the database with the newly created conversion profile to use it later.
For example, replace the med_play conversion param with the following:
s:9:"framerate";s:2:"25";s:13:"audioChannels";i:2;s:17:"audioSamplingRate";i:22050;}
Using the profile
Within the KMC, inside the conversion settings choose the medium profile - now your uploaded files will be transcoded to h264.
Wrapping up
You can now try these new parameters with re-transcoding of an existing (from the investigate tab) video or with a new upload.
Note: If your parameters are incorrect (a miscount of the string length for example), then it will skip ffmpeg and use mencoder instead. To be sure - validate the conversion profile that was used under the investigate tab.




Comments
That's great information,
That's great information, thanks Fen-X!
Use php to "decode" and "encode" Conversion Profile info...
<?php
$param = 'a:7:{s:20:"commercialTranscoder";s:1:"0";s:12:"ffmpegParams";s:0:"";s:14:"mencoderParams";s:0:"";s:10:"flixParams";s:0:"";s:9:"framerate";s:2:"25";s:13:"audioChannels";i:2;s:17:"audioSamplingRate";i:22050;}';
echo "Current Profile:\r\n".var_dump(unserialize($param))."\r\n";
$kaltura["commercialTranscoder"] = "0";
$kaltura["ffmpegParams"] = "-r 29.97 -b 400k -g 100 -ar 22050 -ac 2 -y -s svga -pass 2";
$kaltura["mencoderParams"] = "";
$kaltura["flixParams"]="";
$kaltura["framerate"]="29.97";
$kaltura["audioChannels"]=2;
$kaltura["audioSamplingRate"]=22050;
echo "\r\nNew Params:\r\n".serialize($kaltura);
?>
---Jeff