VP6
[Video Codecs]

General VP6 settings



enum  FE2_CompressMode {
  COMPRESSMODE_GOOD,
  COMPRESSMODE_BEST
}
 

Valid compress modes for VP6, influences encoder speed.

More...
enum  vp6profile {
  VP6_E,
  VP6_S
}
 

Valid profiles for use with the FE2_VP6_PROFILE parameter.

More...
typedef enum vp6profile vp6profile_t
 Valid profiles for use with the FE2_VP6_PROFILE parameter.
#define FE2_VP6_BITRATE
 Alias for FE2_CODECPARAM_BITRATE.
#define FE2_VP6_KFINTTYPE
 Alias for FE2_VCODECPARAM_KFINTTYPE.
#define FE2_VP6_KFFREQ
 Alias for FE2_VCODECPARAM_KFFREQ.
#define FE2_VP6_RC_MODE
 Alias for FE2_VCODECPARAM_RC_MODE.
#define FE2_VP6_CXMODE
 VP6 compress mode.
#define FE2_VP6_SHARPNESS
 Codec parameter for sharpness.
#define FE2_VP6_NOISE_REDUCTION
 Codec parameter for noise reduction.
#define FE2_VP6_PROFILE
 Codec parameter for encoding profile.

Codec name



#define FE2_CODEC_VP6
 Codec name for use with Flix2_AddCodec().

Advanced VP6 settings



#define FE2_VP6_CONCURRENCY
 Codec parameter for concurrency level.
#define FE2_VP6_UNDERSHOOT_PCT
 Codec parameter for undershoot percentage.
#define FE2_VP6_MIN_Q
 Codec parameter for minimum quantizer.
#define FE2_VP6_MAX_Q
 Codec parameter for maximum quantizer.
#define FE2_VP6_TEMPORAL_RESAMPLING
 Codec parameter for temporal resampling.
#define FE2_VP6_TEMPORAL_DOWN_WATERMARK
 Codec parameter for temporal down watermark percentage.

CBR-Specific



#define FE2_VP6_STREAM_PEAK_BITRATE
 The maximum bitrate allowed in the stream.
#define FE2_VP6_STREAM_PREBUFFER
 Seconds of preload that are necessary before starting playback.
#define FE2_VP6_STREAM_OPTIMAL_BUFFER
 Buffer size that the encoder strives to reach or maintain in case of specific frame overshoots.
#define FE2_VP6_STREAM_MAX_BUFFER
 The maximum size of the buffer, in seconds.

VBR-Specific



#define FE2_VP6_2PASS_MIN_SECTION
 VBR_2PASSControl minimum section datarate
#define FE2_VP6_2PASS_MAX_SECTION
 VBR_2PASSControl maximum section datarate

Detailed Description

The VP6 (Flash 8) video codec.

Example Usage:

   sc = Flix2_AddCodec(&codec, flix, FE2_CODEC_VP6);
   // Use 450kbit
   if(sc == ON2_OK)
       sc = Flix2_CodecSetParam(codec, FE2_VP6_BITRATE, 450.0);

Defaults dependent on bits per pixel

Defaults for some encoder parameters are determined based on the bits per pixel, which is determined as follows:

\[ bitsperpixel = \frac{ \textit{FE2\_VP6\_BITRATE} * 1024 } { imagew * imageh * fps } \]

The current defaults are:

                               | <.03 | <.07 | <.12 | <.20 | >=.20
   ================================================================
   FE2_VP6_MIN_Q               |  25  |  15  |  15  |   5  |   5
   FE2_VP6_MAX_Q               |  62  |  56  |  50  |  40  |  32
   FE2_VP6_SHARPNESS           |   1  |   1  |   5  |   7  |   7
   FE2_VP6_NOISE_REDUCTION     |   3  |   0  |   0  |   0  |   0
   FE2_VP6_TEMPORAL_RESAMPLING |   1  |   1  |   0  |   0  |   0

Notes on datarate control

Using the above defaults some material may fail to achieve the requested bitrate. This is highly material dependent, but the result will be a clip with a reduced datarate. If you are intent on achieving a specific datarate and find that your clips are missing it the following settings will help:

   =====================================
   FE2_VP6_MIN_Q                 |   4
   FE2_VP6_NOISE_REDUCTION       |   0
   FE2_VP6_TEMPORAL_RESAMPLING   |   1
   FE2_VP6_STREAM_PREBUFFER      |   5
   FE2_VP6_STREAM_OPTIMAL_BUFFER |   5

Reasoning:


Define Documentation

#define FE2_CODEC_VP6

Codec name for use with Flix2_AddCodec().

Definition at line 84 of file vp6.h.

#define FE2_VP6_2PASS_MAX_SECTION

VBR_2PASSControl maximum section datarate

This value is given as a percentage. The highest datarate, i.e., $\textit{FE2\_VP6\_2PASS\_MAX\_SECTION}\% \times \textit{FE2\_VP6\_BITRATE}$, that can be streamed, and also the highest datarate that the encoder will allow, no matter how difficult the section is.

Note:
Default: 400

Definition at line 336 of file vp6.h.

#define FE2_VP6_2PASS_MIN_SECTION

VBR_2PASSControl minimum section datarate

This value is given as a percentage. The lowest datarate, i.e., $\textit{FE2\_VP6\_2PASS\_MIN\_SECTION}\% \times \textit{FE2\_VP6\_BITRATE}$, that the encoder will allow for any section, no matter how easy the section is. This value is used to prevent difficult sections from stealing too many bits from easy sections.

Note:
Default: 40

Definition at line 326 of file vp6.h.

#define FE2_VP6_BITRATE

Alias for FE2_CODECPARAM_BITRATE.

Codec parameter for stream bitrate. Compressed stream bitrate in kbits/sec.

Note:
Default: 448

Definition at line 124 of file vp6.h.

#define FE2_VP6_CONCURRENCY

Codec parameter for concurrency level.

Setting this value to 1 will allow the encode process to take advantage of multiple cores/processors yielding a potentially significant gain in performance.

Usage Considerations:
The current implementation parallelizes the video encode on keyframe boundaries. To achieve this, each instance (1 per core/processor) must buffer both the raw input frames as well as those encoded. As a result, the memory requirement for each session increases dramatically.
The number of raw (YV12) input frames required per processor is FE2_VP6_KFFREQ or 60 (the current allowed maximum), whichever is smaller. The size of each raw frame can be calculated as follows:

\[ framesiz\_bytes = imagew \times imageh \times \frac{3}{2} \]

Making the input buffer requirements for each processor:

\[ raw\_bufreq = framesiz\_bytes \times \min\{FE2\_VP6\_KFFREQ, 60\} \]

The encoded buffer requirement is the same, as this would be the worst (though unlikely) case, making the per-processor memory increase:

\[ memreq\_increase/processor = 2 \times raw\_bufreq \]

The current maximum number of cores/processors utilized is 8 with the load evenly distributed across those available.
Because of this some thought should be given to queueing encodes to avoid possible failures due to exhaustion of available memory.
Using the above, with FE2_VP6_KFFREQ=60, the per-processor memory increase for some common resolutions are:
   Resolution      |  framesiz_bytes   | memreq_increase/processor |   memreq_increase/2   |   memreq_increase/4   |   memreq_increase/8
   =========================================================================================================================================
   320x240  (QVGA) | 115200  (.11MiB)  | 13824000  (13.18MiB)      | 27648000  (26.37MiB)  | 55296000  (52.73MiB)  | 110592000  (105.47MiB)
   640x480  (VGA)  | 460800  (.44MiB)  | 55296000  (52.73MiB)      | 110592000 (105.47MiB) | 221184000 (210.94MiB) | 442368000  (421.88MiB)
   720x480  (NTSC) | 518400  (.49MiB)  | 62208000  (59.33MiB)      | 124416000 (118.65MiB) | 248832000 (237.30MiB) | 497664000  (474.61MiB)
   720x576  (PAL)  | 622080  (.59MiB)  | 74649600  (71.19MiB)      | 149299200 (142.38MiB) | 298598400 (284.77MiB) | 597196800  (569.53MiB)
   1280x720 (720p) | 1382400 (1.32MiB) | 165888000 (158.2MiB)      | 331776000 (316.41MiB) | 663552000 (632.81MiB) | 1327104000 (1265.63MiB)
Note:
Default: 0 (disabled)
Attention:
Currently to enable this parameter:
Enabling this parameter on a processor that is solely Hyper-Threaded (e.g., early Pentium 4 models) MAY see a decrease in performance, especially under Linux.
See also:
FE2_VP6_CONCURRENCY Performance - Graphs comparing encode times with and without this parameter enabled.

Definition at line 228 of file vp6.h.

#define FE2_VP6_CXMODE

VP6 compress mode.

Valid values are defined by FE2_CompressMode

Note:
Default: COMPRESSMODE_GOOD

Definition at line 149 of file vp6.h.

#define FE2_VP6_KFFREQ

Alias for FE2_VCODECPARAM_KFFREQ.

Video codec parameter for keyframe frequency. Value is in video frames. The interpretation depends on the setting of FE2_VCODECPARAM_KFINTTYPE

See also:
FE2_VideoKeyframeTypes

Note:
Default: $12.0 \times output_fps$ or 360 frames if the framerate is unknown

Definition at line 137 of file vp6.h.

#define FE2_VP6_KFINTTYPE

Alias for FE2_VCODECPARAM_KFINTTYPE.

Video codec parameter for the keyframe interval type. Valid values are defined by FE2_VideoKeyframeTypes.

Note:
Default: MAX_KEYFRAMES

Definition at line 130 of file vp6.h.

#define FE2_VP6_MAX_Q

Codec parameter for maximum quantizer.

Determines the quality of the output. A lower maximum number produces higher quality output.

Note:
Valid range: [0,63]
Default: Bits per pixel dependent
Attention:
Setting this value too low will likely cause the encoder to miss (i.e., overshoot) the target datarate specified by FE2_VP6_BITRATE and, should FE2_VP6_TEMPORAL_RESAMPLING be enabled, result in a large amount of dropped frames. The table mentioned above should be used as a guide in choosing a reasonable value based on the bitrate.

Definition at line 258 of file vp6.h.

#define FE2_VP6_MIN_Q

Codec parameter for minimum quantizer.

Determines the quality of the output. A lower minimum number produces higher quality output.

Note:
Valid range: [0,63]
Default: Bits per pixel dependent

Definition at line 244 of file vp6.h.

#define FE2_VP6_NOISE_REDUCTION

Codec parameter for noise reduction.

Determines the level of noise filtering to apply in the preprocessor. 0 is no preprocessing, 6 is extreme preprocessing.

Note:
Valid range: [0,6]
Setting this value to anything but 0 will result in slowing down the compression speed.
Default: Bits per pixel dependent

Definition at line 170 of file vp6.h.

#define FE2_VP6_PROFILE

Codec parameter for encoding profile.

Note:
Valid values are defined by vp6profile_t Default: VP6_E

Definition at line 175 of file vp6.h.

#define FE2_VP6_RC_MODE

Alias for FE2_VCODECPARAM_RC_MODE.

Video codec parameter for the rate control mode. Valid values are defined by FE2_VideoBitrateControls.

Note:
Default: VBR_2PASSControl

Definition at line 143 of file vp6.h.

#define FE2_VP6_SHARPNESS

Codec parameter for sharpness.

Controls the sharpness of the image in the output. This setting does not impact any other setting and is largely a matter of personal preference. A low sharpness setting will result in fewer visible artifacts but may blur the image somewhat; a high sharpness will result in a sharper image but may result in more visible artifacts.

Note:
Valid range: [0,7]
Default: Bits per pixel dependent

Definition at line 160 of file vp6.h.

#define FE2_VP6_STREAM_MAX_BUFFER

The maximum size of the buffer, in seconds.

Attention:
Valid for CBR only

Definition at line 311 of file vp6.h.

#define FE2_VP6_STREAM_OPTIMAL_BUFFER

Buffer size that the encoder strives to reach or maintain in case of specific frame overshoots.

Note:
Default: 10
Attention:
Valid for CBR only

Definition at line 307 of file vp6.h.

#define FE2_VP6_STREAM_PEAK_BITRATE

The maximum bitrate allowed in the stream.

This value is given as a percentage. The peak bitrate is calculated as follows: $\textit{FE2\_VP6\_STREAM\_PEAK\_BITRATE}\% \times \textit{FE2\_VP6\_BITRATE}$

Note:
Default: 100
Attention:
Valid for CBR only

Definition at line 293 of file vp6.h.

#define FE2_VP6_STREAM_PREBUFFER

Seconds of preload that are necessary before starting playback.

The buffer is used to maintain a consistent datarate and minimize playback interruption.

Note:
Default: 6
Attention:
Valid for CBR only

Definition at line 301 of file vp6.h.

#define FE2_VP6_TEMPORAL_DOWN_WATERMARK

Codec parameter for temporal down watermark percentage.

Specifies the percentage of the datarate buffer remaining below which the encoder is allowed to start dropping frames. Only used if FE2_VP6_TEMPORAL_RESAMPLING is enabled.

Note:
Default: 20
A larger percentage will make it more likely frames will be dropped to achieve the requested FE2_VP6_BITRATE. The converse is also true.

Definition at line 281 of file vp6.h.

#define FE2_VP6_TEMPORAL_RESAMPLING

Codec parameter for temporal resampling.

In particularly difficult regions, if enabled, the encoder will drop frames to achieve the target the data rate. The value of FE2_VP6_TEMPORAL_DOWN_WATERMARK determines the percentage of the datarate buffer below which the encoder is enabled to start dropping frames.

Note:
Default: Bits per pixel dependent
Attention:
Setting FE2_VP6_RC_MODE to CBR_1PASSControl or CBR_2PASSControl will unconditionally set this value to 1. In this case adjusting FE2_VP6_TEMPORAL_DOWN_WATERMARK may improve results.

Definition at line 271 of file vp6.h.

#define FE2_VP6_UNDERSHOOT_PCT

Codec parameter for undershoot percentage.

This value is given as a percentage. Creates output that targets a slightly lower datarate so there are bits available in the buffer to improve difficult sections.

Note:
Default: 90

Definition at line 236 of file vp6.h.


Typedef Documentation

typedef enum vp6profile vp6profile_t

Valid profiles for use with the FE2_VP6_PROFILE parameter.


Enumeration Type Documentation

Valid compress modes for VP6, influences encoder speed.

For use in calls to Flix2_CodecSetParam() and Flix2_CodecGetParam() for the FE2_VP6_CXMODE and FE2_VP6A_CXMODE. For general transcoding (i.e. decoding from one compressed format and encoding to VP6) COMPRESSMODE_GOOD will provide adequate results and the best possible encode time. The quality gain using COMPRESSMODE_BEST will only be visible when using clean raw source or compressing to extremely low bitrates.

Enumerator:
COMPRESSMODE_GOOD 

The encoder balances quality with the amount of time it takes to encode the output with the goal of making the encoding as fast as possible without losing too much quality. This is the default.

COMPRESSMODE_BEST 

The encoder places priority on the quality of the output over encoding speed. The output is compressed at the highest possible quality. This option takes the longest amount of time to encode.

Definition at line 100 of file vp6.h.

enum vp6profile

Valid profiles for use with the FE2_VP6_PROFILE parameter.

Enumerator:
VP6_E 

Default profile used in flash video encoding

VP6_S 

Profile optimized for use with high resolution/datarate video. Decreases decoding complexity allowing playback on resource constrained machines.

Definition at line 113 of file vp6.h.


On2 Technologies, Inc Flix Engine Windows documentation, generated on Tue Nov 2 15:38:07 2010 by doxygen 1.6.1