Automatically Generate A WebM Video Rendition

Problem: A single video asset is provided for a page, but that page should support multiple browsers and formats

Solution: AEM’s DAM can create alternate renditions automatically. It just needs some configuration

Acknowledgement: Thanks to my colleague Ryan Jacobs for his assistance

His writeup contains more details and descriptions of this process.

Step 0: Get a test video to start with

It must be mp4, ogg, or flv. These are the only video formats AEM currently supports for this process.

Step 1: Install FFmpeg on the server hosting CQ

If this is on a development machine, then just grab latest the OS-specific binaries and install them locally:

AEM has built-in FFmpeg support, but doesn’t actually include FFmpeg in its package. So it must be downloaded and installed independently.

Step 2: Add the ffmpeg\bin directory to the PATH variable

This step is probably not required for most installers.  Windows’ recommended binary, however, does not come with any kind of installer.  It’s just a zip file that needs to be extracted somewhere (e.g. \Program Files (x86)). For CQ to find and recognize the executable (ffmpeg.exe), its directory has to be added to the PATH environment variable.  Once done, test that it works by opening a new console window and typing ffmpeg.

Step 3: Restart AEM

FFmpeg doesn’t get recognized until after a restart. If AEM is being loaded through the command line, be sure to close and reopen that console window.

Step 4: Test it

Upload a video to the DAM (here), then click that video.  If FFmpeg is installed and recognized, then thumbnails will automatically be generated with no extra configuration.  If FFmpeg is not installed, nothing but the original video will be shown.

Step 5: Open the Video Profiles folder from the Configuration Profiles Tool

Step 6: Create a New Video Profile Page

New Page
Title: WebM
Name: webm
Video Profile

Step 7: Open the New Page by double-clicking on it

Step 8: Edit the properties for FFmpeg

Click on the Basic Tab
Title: WebM
Description: WebM Video Format
Extension: webm
MIME-type: video/webm
HTML5 video type: video/webm; codecs="vp8, vorbis"
Click on the Video Tab
Codec: libvpx
Click on the Audio Tab
Codec: libvorbis

Step 9: Test it

Upload Test Video
Select the original video
Scroll to the bottom and click on Output File Name: {file}.out.webm
Verify video plays in a modern browser like Chrome

Step 10: Modify The Update Asset Workflow

Navigate to the Update Asset workflow folder within the from the Configuration Profiles Tool

Double click DAM Update Asset to get here.
Double click the FFmpeg transcoding workflow item
Click on the Process tab
Within the arguments list, append ",profile:webm" (sans quotes)

Step 13: Save the Workflow changes

Click Save at the top of the workflow

Step 12: Upload a video to the DAM and wait for the rendition to appear

Depending on the server specs and asset size, encoding can take a while.

Summary: With a little bit of configuration, video transcoding in AEM can be made easy and automatic. A little research on FFmpeg options can also allow much finer control of derived assets

Leave a Reply

Your email address will not be published. Required fields are marked *