How to encode video on demand content

Note: The suggestions in this article are for reference only. We don't provide support for third-party encoders. There's no supporting forum thread for this article.

Microsoft Expression Encoder 4

The sample videos that ship with Wowza media server software and those that you can download from the Video on Demand Tutorial were encoded using Expression Encoder 4, which can generate multiple versions at different bitrates that are properly keyframe-aligned, suitable for multi-bitrate streaming.

The following Expression Encoder 4 presets were used to encode the sample videos:
 

FFmpeg

Note: Updated for FFmpeg version N-52458-gaa96439 (04-30-2013).
FFmpeg is a good option for encoding single videos (multi-bitrate encoding hasn't worked using FFmpeg).
 
  1. To use these FFmpeg commands, get the most recent FFmpeg version from:

    http://ffmpeg.arrozcru.org/autobuilds/

    -or-

    http://www.videohelp.com/tools/ffmpeg
     
  2. Setup the presets, which are required for the commands below:
     
    1. Create the folder structure: <drive letter>:usrlocalshareffmpeg

       
    2. Copy all of the files from the presets folder in the FFmpeg package to this folder.
Note: On OS X, the following examples work with the version of FFmpeg that's installed by Mac Ports. The presets are also installed.
Example FFmpeg commands

The following example uses the Butterfly_HD_1080p.mp4 sample MP4 video file.
ffmpeg -y -i Butterfly_HD_1080p.mp4 -s 320x180 -y -strict experimental -acodec aac -ab 64k -ac 2 -ar 48000 -vcodec libx264 -vprofile baseline -level 30 -g 48 -b 200000 -threads 64 butterflyiphone_320.mp4

ffmpeg -y -i Butterfly_HD_1080p.mp4 -s 640x360 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vprofile baseline -level 30 -g 48 -b 520000 -threads 64 butterflyiphone_640.mp4

ffmpeg -y -i Butterfly_HD_1080p.mp4 -s 320x180 -y -strict experimental -acodec aac -ab 64k -ac 2 -ar 48000 -vcodec libx264 -vprofile main -g 48 -b 270000 -threads 64 butterfly_400.mp4

ffmpeg -y -i Butterfly_HD_1080p.mp4 -s 420x270 -y -strict experimental -acodec aac -ab 64k -ac 2 -ar 48000 -vcodec libx264 -vprofile main -g 48 -b 570000 -threads 64 butterfly_700.mp4

ffmpeg -y -i Butterfly_HD_1080p.mp4 -s 720x406 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vprofile main -g 48 -b 1000000 -threads 64 butterfly_1100.mp4

ffmpeg -y -i Butterfly_HD_1080p.mp4 -s 1024x576 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vprofile main -g 48 -b 1200000 -threads 64 butterfly_1300.mp4

ffmpeg -y -i Butterfly_HD_1080p.mp4 -s 1080x608 -y -strict experimental -acodec aac -ab 128k -ac 2 -ar 48000 -vcodec libx264 -vprofile main -g 48 -b 1400000 -threads 64 butterfly_1500.mp4
The following example uses this mobile sample and improves playback on BlackBerry devices. It uses the FFmpeg developer build from 07-05-2010.
ffmpeg -i Butterfly_HD_1080p.mp4 -s 212x120 -y -strict experimental -acodec aac -ab 96k -ac 2 -ar 48000 -vcodec libx264 -vprofile baseline -g 48 -b 85000 -level 30 -threads 64 butterfly_175k.mp4
You can use also VideoLAN (VLC) for transcoding. For more information, see the VLC transcoding guide.
Note: Microsoft Silverlight players prefer a 2-second keyframe frequency. If you set the -r (fps) flag to half of the -g (GOP) setting, the video will have a 2-second keyframe frequency. In the examples above where -g is 60, you would set -r 30.

Originally Published: 10-11-2010.
Updated: 04-30-2013.

If you're having problems or want to discuss this article, post in our forum.