module Theora:Functions for encoding theora files using libtheora.sig
..end
Author(s): Samuel Mimram
exception Internal_error
Library encountered invalid internal data.
exception Invalid_data
exception Unknown_error of int
val version_string : unit -> string
val version_number : unit -> int * int * int
type
colorspace =
| |
CS_unspecified |
(* | The colorspace is unknown or unspecified | *) |
| |
CS_ITU_REC_470M |
(* | This is the best option for 'NTSC' content | *) |
| |
CS_ITU_REC_470BG |
(* | This is the best option for 'PAL' content | *) |
| |
CS_NSPACES |
(* | This marks the end of the defined colorspaces | *) |
type
pixelformat =
| |
PF_420 |
(* | Chroma subsampling by 2 in each direction (4:2:0) | *) |
| |
PF_reserved |
(* | Reserved value | *) |
| |
PF_422 |
(* | Horizonatal chroma subsampling by 2 (4:2:2) | *) |
| |
PF_444 |
(* | No chroma subsampling at all (4:4:4) | *) |
These enumerate the available chroma subsampling options supported
by the theora format. See Section 4.4 of the specification for
exact definitions.
type
info = {
|
width : |
(* | encoded frame width (should be divisible by 16) | *) |
|
height : |
(* | encoded frame height (should be divisible by 16) | *) |
|
frame_width : |
(* | display frame width | *) |
|
frame_height : |
(* | display frame height | *) |
|
offset_x : |
(* | horizontal offset of the displayed frame | *) |
|
offset_y : |
(* | vertical offset of the displayed frame | *) |
|
fps_numerator : |
(* | frame rate numerator | *) |
|
fps_denominator : |
(* | frame rate denominator | *) |
|
aspect_numerator : |
(* | pixel aspect ratio numerator | *) |
|
aspect_denominator : |
(* | pixel aspect ratio denominator | *) |
|
colorspace : |
(* | colorspace | *) |
|
target_bitrate : |
(* | nominal bitrate in bits per second (between 45kbps and 2000kbps) | *) |
|
quality : |
(* | Nominal quality setting, (between 0 and 63) | *) |
|
quick_p : |
(* | Quick encode/decode | *) |
|
version_major : |
|||
|
version_minor : |
|||
|
version_subminor : |
|||
|
dropframes_p : |
|||
|
keyframe_auto_p : |
|||
|
keyframe_frequency : |
|||
|
keyframe_frequency_force : |
(* | also used for decode init to get granpos shift correct | *) |
|
keyframe_data_target_bitrate : |
|||
|
keyframe_auto_threshold : |
|||
|
keyframe_mindistance : |
|||
|
noise_sensitivity : |
|||
|
sharpness : |
|||
|
pixelformat : |
(* | chroma subsampling mode to expect | *) |
Encoded theora frames must be a multiple of 16 is size;
this is what the width and height members represent. To
handle other sizes, a crop rectangle is specified in
frame_height
and frame_width
, offset_x
and offset_y
. The
offset and size should still be a multiple of 2 to avoid
chroma sampling shifts. Offset values in this structure
are measured from the upper left of the image.
Frame rate, in frames per second, is stored as a rational fraction. So is the aspect ratio. Note that this refers to the aspect ratio of the frame pixels, not of the overall frame itself.
See the example code for use of the other parameters and good default settings for the encoder parameters.
This type is private since it needs private theora parameters.
Une the new_info
function to create an empty one.
typedata_buffer =
(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
type
yuv_buffer = {
|
y_width : |
(* | Width of the Y' luminance plane | *) |
|
y_height : |
(* | Height of the luminance plane | *) |
|
y_stride : |
(* | Lenth, in bytes, per line | *) |
|
uv_width : |
(* | Width of the Cb and Cr chroma planes | *) |
|
uv_height : |
(* | Height of the chroma planes | *) |
|
uv_stride : |
(* | Length, in bytes, per line | *) |
|
y : |
(* | luminance data | *) |
|
u : |
(* | Cb data | *) |
|
v : |
(* | Cr data | *) |
info
structure; frames returned by
the decoder may need to be cropped for display.
All samples are 8 bits. Within each plane samples are ordered by
row from the top of the frame to the bottom. Within each row samples
are ordered from left to right.
module Encoder:sig
..end
module Decoder:sig
..end
module Skeleton:sig
..end