IVideoEncoding#

class video_encoding.IVideoEncoding#

Bases: pybind11_object

Methods

__init__(*args, **kwargs)

encode_next_frame_from_buffer(self, buffer_rgba8)

Encode a frame and write the result to disk.

encode_next_frame_from_file(self, frame_filename)

Read a frame from an image file, encode, and write to disk.

finalize_encoding(self)

Indicate that all frames have been encoded.

start_encoding(self, video_filename, ...)

Prepare the encoding plugin to process frames.

__init__(*args, **kwargs)#
encode_next_frame_from_buffer(
self: video_encoding._video_encoding.IVideoEncoding,
buffer_rgba8: buffer,
width: int = 0,
height: int = 0,
) bool#

Encode a frame and write the result to disk.

Parameters:
  • format (buffer_rgba8 raw frame image data;) – R8G8B8A8; size: width * height * 4

  • appropriately (height frame height; can be inferred from shape of buffer_rgba8 if set)

  • appropriately

Returns:

True if successful, else False.

encode_next_frame_from_file(
self: video_encoding._video_encoding.IVideoEncoding,
frame_filename: str,
) None#

Read a frame from an image file, encode, and write to disk. Warning: pixel formats other than RGBA8 will probably not work (yet).

Parameters:

formats (frame_filename name of the file to read. Supported file) – see carb::imaging

finalize_encoding(
self: video_encoding._video_encoding.IVideoEncoding,
) None#

Indicate that all frames have been encoded. This will ensure that writing to the output video file is done, and close it.

start_encoding(
self: video_encoding._video_encoding.IVideoEncoding,
video_filename: str,
framerate: float,
nframes: int,
overwrite_video: bool,
) bool#

Prepare the encoding plugin to process frames.

Parameters:
  • written (video_filename name of the MP4 file where the encoded video will be)

  • second (framerate number of frames per)

  • unknown (nframes total number of frames; if)

  • 0 (set to)

  • set (overwrite_video if)

  • otherwise (overwrite existing MP4 file;)

  • exists. (refuse to do anything if the file specified in video_filename)

Returns:

True if preparation succeeded and the encoding plugin is ready; False otherwise.