class FFmpeg::Frame

Defined in:

ffmpeg/frame.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(width : Int, height : Int, pixel_bytes : Int) #

DEPRECATED specify pixel format instead of byte size


[View source]
def self.new(width : Int, height : Int, pixel_format : LibAV::PixelFormat, align : Int = 1, buffer : Bytes | Nil = nil) #

[View source]
def self.new(source : FFmpeg::Frame) #

[View source]
def self.new(canvas : StumpyCore::Canvas) #

canvas helpers


[View source]
def self.new #

[View source]

Instance Method Detail

def allocate_buffer(width : Int, height : Int, pixel_bytes : Int) #

DEPRECATED specify pixel format instead of byte size


[View source]
def allocate_buffer(width : Int, height : Int, pixel_format : LibAV::PixelFormat, align : Int = 1, buffer : Bytes | Nil = nil) #

[View source]
def buffer : Bytes #

[View source]
def convert_to(pixel_format : LibAV::PixelFormat) : FFmpeg::Frame #

helper for converting to another format

NOTE : when streaming video you'd want to cache this scaler.


[View source]
def copy_to(frame : FFmpeg::Frame) #

copies the image buffer to a new frame


[View source]
def crop(top : Int32, left : Int32, bottom : Int32, right : Int32) : FFmpeg::Frame #

crop helper - values are pixel distances from the edges

NOTE : when streaming video you'd want to cache scalers. This is useful where you need to crop different segments each frame


[View source]
def finalize #

[View source]
def height #

[View source]
def key_frame? : Bool #

[View source]
def pixel_format : PixelFormat #

[View source]
def quick_crop(top : Int32, left : Int32, bottom : Int32, right : Int32) : FFmpeg::Frame #

crops the frame for use with scaler to combine cropping in a single operation


[View source]
def to_canvas : StumpyCore::Canvas #

a very simple way to get a stumpy canvas from a frame also very inefficient so I don't recommend using in production


[View source]
def to_unsafe : Pointer(FFmpeg::LibAV::Util::AVFrame) #

[View source]
def unsafe_crop(top : Int32, left : Int32, bottom : Int32, right : Int32) : FFmpeg::Frame #

[View source]
def width #

[View source]