Configuring the Video Stream Encoder
This section provides more details on the encoders supported by Video Stream as described above. It also explains how to configure to support various scenarios.
Encoder | Target Codec |
---|---|
Microsoft Expression Encoder 4.0 Free edition |
VC1 Progressive Downlaod (non-Smooth Streaming) |
|
VC1 Smooth Stream |
FFMPEG with xlib264 and qt-faststart.exe |
H264 progressive download |
By default, Video Stream uses Smooth Stream encoding for web playback (that is, browser) and progressive H264 encoding for mobile viewing.
As described in the Software Prerequisites for the Encoding Service above, if you wish to do Smooth Streaming or use VC1 as a target codec you need this encoder.
You can get it from: http://www.microsoft.com/en-us/download/details.aspx?id=27870. This encoder is also the default for encoding the thumbnail. Using the FFMPEG encoder for producing the thumbnail is described below.
Starting with 2.6.3, it is possible to specify a customized preset file to use when Microsoft Expression Encoder transcodes a video. For example, you would use a custom preset file if you want to change how many stream gets generated when transcoding to the smooth stream format.
Here are the steps you need to take:
- Create a preset file using the Microsoft Expression Encoder client application.
- Place the preset file in the root folder of the Video Stream encoding service.
- Open the encoding service configuration file. It is located at the root folder of the Video Stream encoding service.
- Find the entries that have the following format:
- Add the name of you customized preset file in between the
“”
. Such as - Add a video and it uses the preset file while encoding.
There is an entry for videos that have a height of 1800 or more, 720 to 1079 and one for videos that are less than 720.
For more information on how to create a preset file from within the Microsoft Expression Encoder, see http://msdn.microsoft.com/en-us/library/cc294566(v=expression.40).aspx
FFMPEG
As described in the Software Prerequisites for the Encoding Service, if you wish to encode to a portable format that is viewable across a wide range of mobile devices you have to transcode your videos to a H264 codec.
We support this scenario through the use of a widely used command line encoder called FFMPEG (in conjunction with the QT-FastStart).
FFMPEG comes in many flavors; the one we tested against is compiled with an x264 library in it to enable H264 transcoding.
You can get it from:
- 32 Bit: http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20121125-git-26c531c-win32-static.7z
- 64 Bit: http://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20121125-git-26c531c-win64-static.7z
QT-FastStart.exe
Another tool that we use is called qt-faststart.exe
. This tool makes it so a video can be downloaded using the progressive download technique. You can read about this tool here: You can download the version we use from:
- 32 Bit: http://ffmpeg.zeranoe.com/builds/qt-faststart/win32/qt-faststart-git-91a4abd8-win32.7z
- 64 Bit: http://ffmpeg.zeranoe.com/builds/qt-faststart/win64/qt-faststart-git-91a4abd8-win64.7z
How to install FFMPEG and QT-FastStart.exe
- Download both tools from either the 32 or 64 bit version. They are compressed with the 7zip utility you can find at http://www.7-zip.org/.
- Extract the content of the FFMPEG file.
- Copy the
ffmpeg.exe
from the bin folder to the root folder of the Video Stream encoding service. - Copy the content of the presets folder to a new folder named
ffpresets
at the root folder of the Video Stream encoding service folder. - Extract the content of the
QT-FastStart
file. - Copy
qt-faststart.exe
to the root folder of the Video Stream encoding service.
Unless changed during the installation of the Video Stream additional components, the encoding service should be located at C:\Program Files (x86)\NewsGator\Video Stream Encoding Service
.
As of Video Stream 2.6.3, a command line encoder can be used for video transcoding. Our use of FFMPEG/QT-FastStart is a kind of reference implementation although we don’t actually reference FFMPEG or any other command line tools in our code base. Instead, we call script files that execute the command line encoder.
Below are those files that can be found in the root folder of the Video Stream encoding service:
- NG.CommandLine.GenerateThumbnail.txt: This file holds commands to get FFMPEG to generate the thumbnail image for the video.
- NG.CommandLine.GetVideoInformation.txt: This file holds commands to call the MediaInfo tool to read duration, bit rate, width and height information from the video file to transcode.
- NG.CommandLine.PreProcessFile.txt: This file holds commands that uses FFMPEG to rotate the video back to a vertical position. This works if the source video has rotation metadata in it that can be used to figure out if and how much the video must be rotated.
- NG.CommandLine.ProgressiveH264.txt: This file holds commands to transcode the video into an H264 format optimized for viewing in from a video player on a desktop. It also ensures the video can be truly used for progressive download by passing the resulting transcoded video to
qt-faststart.exe
. - NG.CommandLine.ProgressiveMobileH264.txt: This file holds commands to transcode the video into an H264 format optimized for viewing in from a video player on a mobile device. It also ensures the video can be truly used for progressive download by passing the resulting transcoded video to
qt-faststart.exe
.
Since all command line encodings are stored in script files it is possible for users to change settings used by the command line encoder.
If you wish to change the commands that are sent to the command line encoder, make a copy of the default script file we provide and change the settings in that new file.
After that, specify the new script file in the encoding service configuration file. If you wish to revert back to the default script, make the setting null and the service uses the script we install by default.
- NG.CommandLineEncoder.GenerateThumbnail.Script
Default file used if none specified in the setting. File is located in the root folder of the encoding service:
NG.CommandLine.GenerateThumbnail.txt
Description: Runs command to generate the thumbnail that is used to represent the video.
- NG.CommandLineEncoder.PreProcess.Script
Default file used if none specified in the setting. File is located in the root folder of the encoding service:
NG.CommandLine.PreProcessFile.txt
Description: Runs commands before the video is transcoded. The commands we ship with checks if the video is rotated and rotates it back.
- NG.CommandLineEncoder.ProgressiveH264.Script
Default file used if none specified in the setting. File is located in the root folder of the encoding service:
NG.CommandLine.ProgressiveH264.txt
Description: Runs commands to encode to H264 progressive download optimized for viewing in the web player.
- NG.CommandLineEncoder.ProgressiveMobileH264.Script
Default file used if none specified in the setting. File is located in the root folder of the encoding service:
NG.CommandLine.ProgressiveMobileH264.txt
Description: Runs commands to encode to H264 progressive download optimized for viewing on mobile devices.
- NG.CommandLineEncoder.ProgressiveVC1.Script
Default file used if none specified in the setting. File is located in the root folder of the encoding service:
NG.CommandLine.ProgressiveVC1.txt
Description: Runs commands to encode to VC1 progressive download optimized for viewing in the web player.
- NG.CommandLineEncoder.KontikiH264.Script
Default file used if none specified in the setting. File is located in the root folder of the encoding service:
NG.CommandLine.ProgressiveH264.txt
Description: Runs commands to encode to H264 progressive download for use with the Kontiki platform.
Starting with version 2.6.3 of Video Stream you gain a lot more control over thumbnail image generation. You now have 2 options for thumbnail generation.
- Using Microsoft Expression Encoder:
Before Video Stream 2.6.3 this was the only option. This remains the default option.
- Using FFMPEG Command Line Encoder:
As of 2.6.3, you can use a command line encoder to generate a thumbnail for the video.
In the config file of the encoding service you find the following entry:
When the value of this entry is null, the encoding service uses Microsoft Expression Encoder to generate the thumbnail for the video.
To use a command line encoder script to generate the thumbnail specify the following:
When using the command line thumbnail generator you can also specify via the configuration file at what position in the video you should take the thumbnail. By default, the thumbnail is taken 5 seconds into the video.
For example to get a thumbnail at 7 seconds into a video you would do the following:
Starting with 2.6.3 it is possible to use progressive download instead of Smooth Streaming for video encoding and playback.
To switch over to progressive download you have to do the following:
- Download the files required to use FFMPEG and
QT-FastStart.exe
. - Go to the Video Stream properties page.
- Set streaming option to Progressive Download.
- All of your existing videos gets re-encoded to the H264 progressive download format.
Since FFMPEG and QT-FastStart are used to encode to the H264 progressive download format, ensure those tools are installed before switching to progressive download.
If you already have videos encoded in the Smooth Streaming format, they are unavailable until they are all re-encoded to the H264 progressive download format.