• How to encode video on demand content

    Note: The suggestions in this article are for reference only. We do not provide support for third-party encoders. There is no supporting forum thread for this article.

    Microsoft Expression Encoder 4


    The Wowza sample videos (that ship with Wowza Media Server and those that can be downloaded from Video on Demand Tutorial) were encoded using Expression Encoder 4, which can generate multiple versions at different bitrates that are properly key-frame aligned, suitable for muli-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>:\usr\local\share\ffmpeg

      2. Copy all of the files from the presets folder in the FFmpeg package to this folder.


    Note: On Mac 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 this sample MP4 video file.
    Code:
    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.
    Code:
    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 key frame frequency. If you set the -r (fps) flag to half of the -g (GOP) setting, the video will have a 2-second key frame frequency. In the examples above where -g is 60, you would set -r 30.

    Richard

    This article was originally published in forum thread: How to record using mp4 started by corriepotter View original post
    Comments 10 Comments
    1. HappyJonee -
      I tried using the ffmpeg command for the blackberry but i always get an error stating that ipod302 preset not found... use a vpre value.... or something like that. Any hint on what I've done wrong?
    1. rrlanham -
      Take a look at the ffmpeg setup steps, step 2, in this post:
      http://www.wowzamedia.com/forums/con...ideo-on-Demand

      Richard
    1. mikuko -
      The "-vpre" switch has changed in the latest build of x264 (so also inFFmpeg) to "preset". Use that and it should be fine.
    1. mikuko -
      You should maybe add the "-threads 0" to the encoding parameters so ffmpeg can use more threads as it needs them (using it without it can be very slow). More info here: http://rob.opendot.cl/index.php/usef...ncoding-guide/ and here http://ubuntuforums.org/showthread.php?t=786095
    1. HappyJonee -
      Thanks folks! I'll try it.
    1. amcorona -
      If anyone has Adobe Media Encoder CS5 I would go with that. CS4 is too slow (mac side at least).
      I like it because I can run batch conversions and show anyone without command line experience how to run a batch job.

      Why the preference on 48k audio instead of 44.1?

      Settings below:

      http://amcorona.com/cs5_01.jpg

      http://amcorona.com/cs5_02.jpg

      Off topic but I have also used Miro Video converter for webm/ogv files (latest Sonrenson Squeeze was also too slow).
    1. welbyobeng -
      Can someone explain to me why "-threads 64" ? What does that mean
    1. rrlanham -
      I'm not exactly sure. Here is ffmpeg documentation:

      http://ffmpeg.org/ffmpeg-doc.html

      Although they don't provide the explanation you are looking for there

      Richard
    1. mikuko -
      You should actually add "-threads 0" as I suggested earlier the you let Ffmpeg decide how many threads it should use to encode. If you put 64 it will be fixed on as many as 64 threads as possible which is usually not optimal (especially if you're running parallel encodings).
    1. steveitl -
      hello guys,
      sorry if revive a old thread,
      i'm looking for a ffmpeg command line optimized for VOD mobile streaming (RTSP blackberry) i have try some example but i'm not sure if is possible optimize more my conversion . i'm looking for a command compatible and optimized with last version of FFMPEG . someone have a updated conversion string for make this type of conversion ?
      I use Wowza 3.1.2 on Windows 2008R2 64bit, 24GB RAM, 8core .

      thanks,
      steve