Configuring Automatic Video Conversions on The Nuxeo Platform Configuring Automatic Video Conversions on The Nuxeo Platform

Today we have a question from Hugues. He asks how to have automatic video conversion based on a pre-defined transcoding profile.

Right now when you upload a video to Nuxeo, it's converted first to MP4 with a maximum height of 480, then to WebM with the same height. It's automatic, you don't have to click on anything. You just have to create a Video document. On the summary tab you will also see a button to convert the video to OGG format with a maximum height of 480.

This is the default behavior and as usual it's configurable through extension points. If you go on the Nuxeo Platform Explorer and type 'video' in the filter, you'll be left with two extension points: automaticVideoConversions and videoConversions.

First, let's talk about videoConversions. It defines all the conversions available on the summary tab of a document. The default contribution looks like this:

  <extension point="videoConversions" target="">

&lt;videoConversion converter="convertToMP4" height="480" name="MP4 480p"/&gt;
&lt;videoConversion converter="convertToWebM" height="480" name="WebM 480p"/&gt;
&lt;videoConversion converter="convertToOgg" height="480" name="Ogg 480p"/&gt;


As you can see we have the same conversions I described earlier. The converter property refers to the Nuxeo converters defined with the appropriate extension point. The height property is the maximum height of the video. Don't worry, it will keep the original video ratio. The name property is used as the identifier for the videoConversion and will be used as the label in the summary tab of the video.

Of course the following extension point called automaticVideoConversions is here to define which one will be launched automatically. It uses the same name as the previous extension point.

  <extension point="automaticVideoConversions" target="">

&lt;automaticVideoConversion name="MP4 480p" order="0"/&gt;
&lt;automaticVideoConversion name="WebM 480p" order="10"/&gt;


Now we can do a simple example and see what contribution we should write if we wanted to stop the automatic MP4 conversion, remove the OGG option and add a new one. Let's say we want a conversion to MP4 with a maximum height of 240 and make it automatic. Here's what we could do:

  <extension point="videoConversions" target="">

&lt;videoConversion converter="convertToMP4" height="240" name="MP4 240p"/&gt;
&lt;videoConversion enabled="false" converter="convertToOgg" height="480" name="Ogg 480p"/&gt;

<extension point="automaticVideoConversions" target="">

&lt;automaticVideoConversion enabled="false" name="MP4 480p" order="0"/&gt;
&lt;automaticVideoConversion name="MP4 240p" order="0"/&gt;


To set this up with Nuxeo Studio, you have to go into the Advanced Settings menu, create new XML Extensions and paste the above code. Then reload your project as you usually do.

Once you've done that, you won't see the disabled converted video anymore. Which means that if you had previously converted a video with the OGG 480p, you won't see it in the summary tab. But don't worry, they are still on the document. You can access them like any other property.

The MP4 240 conversion will have to be triggered manually on existing documents. This is because the automatic conversions are launched when the document is created or modified.