Codecs

class av.codec.codec.Codec

Bases: object

A single encoding or decoding codec.

This object exposes information about an availible codec, and an avenue to create a CodecContext to encode/decode directly.

>>> codec = Codec('mpeg4', 'r')
>>> codec.name
'mpeg4'
>>> codec.type
'video'
>>> codec.is_encoder
False
audio_formats

A list of supported audio formats, or None.

Type:list of AudioFormat
audio_rates

A list of supported audio sample rates, or None.

Type:list of int
auto_threads
bitmap_sub
channel_conf
create()
delay
descriptor
dr1
draw_horiz_band
experimental
frame_rates

A list of supported frame rates, or None.

Type:list of fractions.Fraction
frame_threads
hwaccel
hwaccel_vdpau
id
intra_only
is_decoder
is_encoder
long_name
lossless
lossy
name
neg_linesizes
param_change
reorder
slice_threads
small_last_frame
subframes
text_sub
truncated
type

The media type of this codec.

Examples: ‘audio’, ‘video’, ‘subtitle’.

Type:str
variable_frame_size
video_formats

A list of supported video formats, or None.

Type:list of VideoFormat
class av.codec.context.ThreadType

Bases: av.enums.EnumFlag

AUTO = <ThreadType:AUTO(3)>
FRAME = <ThreadType:FRAME(1)>
NONE = <ThreadType:NONE(0)>
SLICE = <ThreadType:SLICE(2)>
class av.codec.context.SkipType

Bases: av.enums.EnumItem

ALL = <SkipType:ALL(48)>
BIDIR = <SkipType:BIDIR(16)>
DEFAULT = <SkipType:DEFAULT(0)>
NONE = <SkipType:NONE(-16)>
NONINTRA = <SkipType:NONINTRA(24)>
NONKEY = <SkipType:NONKEY(32)>
NONREF = <SkipType:NONREF(8)>
class av.codec.context.CodecContext

Bases: object

bit_rate
bit_rate_tolerance
close(bool strict=True)
codec
static create(codec, mode=None)
decode(Packet packet=None)

Decode a list of Frame from the given Packet.

If the packet is None, the buffers will be flushed. This is useful if you do not want the library to automatically re-order frames for you (if they are encoded with a codec that has B-frames).

encode(Frame frame=None)

Encode a list of Packet from the given Frame.

extradata
extradata_size
is_decoder
is_encoder
is_open
max_bit_rate
name
open(bool strict=True)
options

options: dict

parse(str input_, allow_stream=False)
profile
skip_frame

One of SkipType.

thread_count
thread_type

One of ThreadType.

ticks_per_frame
time_base
type