video

this module provides the video codec interface. Encoders, Decoders and their support code.

class pyrana.video.Decoder(input_codec, params=None)

Decodes video Packets into video Frames.

classmethod from_cdata(ctx)

builds a pyrana Video Decoder from (around) a (cffi-wrapped) libav* (video)decoder object. The libav object must be already initialized and ready to go. WARNING: raw access. Use with care.

static wire(dec)

wire up the Decoder. See codec.wire_decoder

class pyrana.video.Encoder(output_codec, params)

Encode video Frames into Packets.

classmethod from_cdata(ctx, params, codec=None)

builds a pyrana video Encoder from (around) a (cffi-wrapped) liabv* (audio) context. WARNING: raw access. Use with care.

static wire(enc)

wire up the Encoder. See codec.wire_encoder

class pyrana.video.Frame(width, height, pixfmt)

A Video frame.

asr

The sample aspect ratio of the frame.

coded_pict_number

Picture number in bitstream order.

display_pict_number

Picture number in display order.

image(pixfmt=None)

Returns a new Image object which provides access to the Picture (thus the pixel as bytes()) data.

is_interlaced

Is the content of the picture interlaced?

pict_type

Picture type of the frame, see AVPictureType.

top_field_first

If is_interlaced(), is top field displayed first?

class pyrana.video.Image

Represents the Picture data inside a Frame.

blob()

returns the bytes() dump of the object.

convert(pixfmt)

convert the Image data in a new PixelFormat. returns a brand new, independent Image.

classmethod from_cdata(ppframe, sws=None, parent=None)

builds a pyrana Image from a (cffi-wrapped) libav* Frame object. The Picture data itself will still be hold in the Frame object. The libav object must be already initialized and ready to go. WARNING: raw access. Use with care.

height

Frame height. Expected to be always equal to the stream height.

is_shared

Is the underlying C-Frame shared with the parent py-Frame?

pixel_format

Frame pixel format. Expected to be always equal to the stream pixel format.

plane(idx)

Read-only byte access to a single plane of the Image.

planes

Return the number of planes in the Picture data. e.g. RGB: 1; YUV420: 3

width

Frame width. Expected to be always equal to the stream width.

class pyrana.video.SWSMode

SWS operational flags. This wasn’t a proper enum, rather a collection of #defines, and that’s the reason why it is defined here.

pyrana.video.fill_yuv420p(frame, i)

fill a video frame with a test pattern.