WebM Preset Customization

Last Updated: Apr 25, 2014 01:17PM PDT
WebM is a open source (non-proprietary) format which uses the VP8 video codec.  The container is based on an open source format called Matroska. (Squeeze also allows for exporting Matroska files using the VP8 video codec.) The audio codec used in WebM and Matroska files is the open source Vorbis audio codec commonly used in the OGG file format, which is also available in Squeeze.

WebM's VP8 codec is similar to the H.264 codec as far as file size and output quality are concerned. The question of whether to use WebM or H.264 then mostly comes down to browser compatibility. Because H.264 is a proprietary codec Firefox and Chrome do not support playback of H.264 files in HTML5 natively. In order to use the HTML5 video tag in Chrome and Firefox users will need to encode their content into WebM files to make sure they are viewable by all users.

To play back a WebM file locally you will need either the VLC Player, Perian Plugin for Quicktime (Mac), or you can drop your WebM file into the Google Chrome browser.

This article will help walk through the various settings on the WebM and Matroska (MKV) presets.

First you will notice that each preset frame size has an RTMP variant. The difference of the RTMP presets is they are all set to CBR (constant bit rate) which is often a better option when streaming using RTMP.

Here is an overview of the preset with the advanced settings enabled:

A video codec is the software application that compresses the video portion of your movie. Currently the only codec available in the WebM format is VP8. When encoding to MKV in Squeeze, VP8 is also your only option.

You have the option for one pass or two pass encoding. In general two-pass encoding results in better quality and more accurate data rate control. The idea is that the encoder makes a first pass through the video data and collects statistics about each frame that can then be used to better allocate bits between different frames or sections of the video. It will however take up to twice the time as would a single pass encode.

Frame Rate
Indicates the number of frames (individual pictures of the movie) that are played each second. The higher you set the Frame Rate, the smoother the playback appears. The default frame rate is 1:1, which means "one to one" so if the source file is 30 frames per second (fps), the output will be 30fps as well. This is the optimal setting unless your source file is greater than 30fps, in which case you will most likely want to specify a smaller frame rate such as half (1:2).

Data Rate
Data Rate (bit rate) is the single greatest determining factor of the quality and size of the output video file. Select the preset Data Rate that meets your audience's hardware and available bandwidth. The greater the data rate, the higher quality the output, but larger the resources -both on the local machine and the network -will be required to play back the file.

To complete the explanation of the Simple settings let's move over to the right column.

Frame Size
This specifies the width and height and aspect ratio policy of your movie. There are four choices of aspect ratio policy found in the Frame Size section:
Same As Source: This will output files with the same frame size as the source file. When this is selected, the Frame Size fields will become inactive.

Unconstrained: Allows you to freely change the width and height of the video at the expense of the aspect ratio. If the aspect ratio between the source and the output is different, then the video will be squished or stretched to comply with the newly entered settings.

Maintain Aspect Ratio: Constrains the video, so if you enter the width, the height is populated automatically, or vice versa. By default, the Maintain Aspect Ratio option is selected.

Letter Box or Pillar: Maintains the original size of the video and places black bars on the side of the video for pillar and on the top for letter box if the aspect ratio is different between the source frame size and the output frame size.
Note: Only even numbered dimensions are allowed for the frame size

Key frames
In video compression, a key frame, also known as an Intra Frame, is a frame in which a complete image is stored in the data stream.

Only changes that occur from one frame to the next are stored in the data stream. This reduces the file size without a reduction in visual quality. This technique capitalizes on the fact that most video sources (such as a typical movie) have only small changes in the image from one frame to the next. Whenever a drastic change to the image occurs, such as when switching from one camera shot to another or at a scene change, a key frame helps to keep the quality high.
Key Frame Every will allow you change the maximum number of frames that are allowed between key frames. You can change the frames according to “key frames per second” or “key frames per number of overall frames”.
In “key frames per number of overall frames” you can choose between 1 and 500 frames. In more complex video with fast action this option should be set to a lower value to allow more key frames because of the potentially large changes between each frame.
Advanced Settings
Clicking the Advanced button expands the dialog box further to provide options for advanced users. These features give you great looking digital video, even at very low data rates. We will go back to the Left column and work our way down.

Profile (size vs. complexity)
This slider sets the encoder profile. For values above 0 the encoder increasingly optimizes for reduced complexity playback on low powered devices at the expense of encode quality. In general most users will want to set a value of 0 unless they are encoding high resolution content and require playback on very low power devices.

Encoding Threads
This will change the number of CPU threads that are accessed during encoding. There is around 2 threads per core, so if you want to use the maximum amount of CPU power on your project, you can increase this field accordingly. There isn’t a danger of setting more threads than your computer actually has, so if in doubt, set this number higher than the number of threads you think you might have.

Quality vs speed
Best This usually gives the best quality output but is extremely slow. In general this is not a recommended setting unless you have a lot of time on your hands.

Good This will probably be what most users use most of the time. Within the scope of "good" quality you can set the Quality/Speed Slider from 0 to 6. Setting Good quality and --cpu-used=0 will give quality that is usually very close to and even sometimes better than that obtained with Best but the encoder will typically run about twice as fast. Setting the slider to 1 or 2 will give further significant boosts to encode speed, but will start to have a more noticeable impact on quality and may also start to effect the accuracy of the data rate control. Setting the slider to 4 or 5 will turn off "rate distortion optimization" which has a big impact on quality, but also greatly speeds up the encoder.

Fastest This mode allows the encoder to auto adjust the speed vs. quality trade-off in order to optimize encode times. The Quality/Speed Slider will move from 0-15. It is worth noting that in Fastest mode the encode quality will depend on how hard a particular clip or section of a clip is and how fast the encoding machine is. In this mode the results will thus vary from machine to machine and even from run to run depending on what else you are doing.
VBR Variability
It controls how the codec distributes bits between easier and harder sections or frames, based on complexity statistics gathered for each frame during the first pass. If you select a value of 100 then the allocation will be linear based on the relative complexity value for each frame when compared to the average for the clip For values of less than 100 the allocation does not increase (or decrease) as sharply in response to a frames relative complexity and a value of 0 means that the complexity is ignored completely when allocating bits. A value of 50 is recommended by the VP8 community.

Note: This parameter is only active when 2 Pass VBR is selected

Minimum/Maximum VBR Data Rate
These next to parameters are only active if the method is set to 2 Pass VBR. They set a nominal target bitrate range within which the VBR encoder should try and remain when allocating bits to frames or sections. The numbers represent a percentage of the average allocation per frame.

It is recommended by the VP8 community that the minimum be set between 0 and 20 percent, and the maximum between 400 and 800 percent.

Data rate undershoot
This creates an output that targets a slightly lower data rate (a percentage of the target data rate) so bits are available in the buffer to improve more complex portions. It also means the overall data rate of the file will be lower. The default is 100% which means that it won’t do any undershooting unless you move the slider down.

Minimum/Maximum Quality Sliders
Minimum Quality -Worst allowed frame quality (lower is worse). A high number ensures a frame will not appear poorly but it may hamper the compressor’s ability to hit the data rate you requested without dropping frames.
Maximum Quality - The best allowed frame quality. Higher is generally better.
Automatically use Alternate Reference frames
An Alternate Reference frame can be anything the codec needs it to be, such as an artificial frame derived from several real input frames.

When "Automatically use alternate reference frames" feature is enabled the default mode of operation is to either use a previous golden frame when this frame is updated, or with a copy of a frame derived from some point of time in the future (the choice is made automatically by the encoder). The "lag in frames" parameter defines an upper limit on the number of frames into the future that the encoder can look.

Lag in Frames
This parameter defines an upper limit on the number of frames into the future that the encoder can look. It is only useful in two pass at the moment. It's required to make use of
alternate reference frames, which are only implemented in two pass right now.

Maximum Buffer Size
The maximum size of the buffer, in seconds. Output that will be streamed using a TrueCast Server, the maximum buffer size is 6 seconds.

Note: The buffer level is not a delay playback control. The buffer is how much of the video is being stored on the viewers machine.

Starting Buffer Level
The number of seconds of data that are preloaded by the media player before playback. The buffer is used to maintain a consistent data rate and minimize playback interruption.

Optimal Buffer Level
The buffer size, in seconds, that the encoder strives to reach or maintain in case of specific frame overshoots.

Rate Control Resizing (up/down threshold)
This one allows VP8 to scale down the video frame in order to meet data rate constraints. The frame is scaled down prior to encoding. The decoder scales the frame to original size. This should generally be left unchecked. The sliders won’t be active if unchecked

Drop frames to maintain data rate (threshold)
Allows the compressor to drop frames in order to hit a specific data rate. In particularly difficult portions of the file, the encoder will drop frames to achieve the target data rate.

The Threshold slider (known as the drop frames watermark slider when using the VP6 codec) determines the percentage of the data rate buffer below which the encoder is enabled to start dropping frames. The threshold slider is only active after the Drop Frames box is checked.

Noise filtering level
The level of video noise filtering to apply. A level of 0 is no pre- processing, 6 is highest level of temporal pre-processing.

Static region threshold
This setting is to optimize live video conferencing, and should be set to Zero when using the codec with Squeeze.

Expected CPU cores for playback
The decoder will usually automatically use an appropriate number of threads according to how many cores are available but it may only use multiple threads if this is set to more than 0.

Error Resilient
This mode is to optimize the encoder for live video conferencing, and should be unchecked when using the codec with Squeeze.
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found