cyndilib.video_frame#
VideoFrame#
- class cyndilib.video_frame.VideoFrame#
Bases:
objectBase class for video frames
- frame_format#
FrameFormat
The current
FrameFormattypeNew in version 0.1.1.
- Type:
frame_format
- get_buffer_size(self)#
- get_format_string(self) str#
Get the video format as a string based off of resolution, frame rate and field format (“1080i59.94”, etc)
- get_frame_rate(self) Fraction#
Get the video frame rate
- get_line_stride(self)#
- get_resolution(self)#
Get the video resolution as a tuple of
(width, height)
- is_progressive#
bool
True if the current
frame_formatis progressive, False if interlacedNew in version 0.1.1.
- Type:
is_progressive
- set_frame_format(self, fmt: FrameFormat) None#
Set the
FrameFormattypeNew in version 0.1.1.
- set_frame_rate(self, value: Fraction)#
Set the video frame rate
- set_progressive(self, value: bool) None#
Set whether the video frame is progressive or interlaced
Note
Setting this to
Falsewill set theframe_formattointerleavedwhich indicates that the frame is a fielded, but complete frame (comprised of both fields).If you want to specify individual fields, you should set the
frame_formatdirectly tofield_0orfield_1using theset_frame_format()method.- Parameters:
value (bool) – If True, set to progressive. If False, set to interlaced.
New in version 0.1.1.
- xres#
X resolution (width)
- yres#
Y resolution (height)
VideoRecvFrame#
- class cyndilib.video_frame.VideoRecvFrame#
Bases:
VideoFrameVideo frame to be used with a
receiver.Receiver- Parameters:
max_buffers (int, optional) – The maximum number of items to store in the buffer. Defaults to
4
Incoming data from the receiver is placed into temporary buffers so it can be read without possibly losing frames.
The buffer items retain both the frame data and corresponding timestamps. They can be read using the
fill_p_data()method or using the buffer protocol.- fill_p_data(self, dest: uint8_t[:])#
Copy the first buffered frame data into the given destination array (or memoryview).
The array should be typed as unsigned 8-bit integers sized to match that of
get_buffer_size()
- get_view_count(self)#
- skip_frames(self, eager: bool)#
Discard buffered frame(s)
If the buffers remain full and the application can’t keep up, this can be used as a last resort.
- Parameters:
eager (bool) – If True, discard all buffered frames except one (the most recently received). If False, only discard one frame
Returns the number of frames skipped
VideoFrameSync#
- class cyndilib.video_frame.VideoFrameSync#
Bases:
VideoFrameVideo frame for use with
framesync.FrameSyncUnlike
VideoRecvFrame, this object does not store or buffer any data. It will always contain the most recent video frame data after a call toframesync.FrameSync.capture_video().This is by design since the FrameSync methods utilize buffering from within the NDI® library.
Data can be read using the
get_array()method or by using the buffer protocol.- get_array(self)#
Get the video frame data as an
numpy.ndarrayof unsigned 8-bit integers
VideoSendFrame#
- class cyndilib.video_frame.VideoSendFrame#
Bases:
VideoFrameVideo frame for use with
sender.SenderNote
Instances of this class are not intended to be created directly nor are its methods. They are instead called from the
sender.Senderwrite methods.- destroy(self)#
- get_write_available(self)#
- write_data(self, data: uint8_t[:])#
Write a frame of video data to the internal buffer
The buffered data will then be sent on the next call to
sender.Sender.send_video()orsender.Sender.send_video_async()- Parameters:
data – A 1-d array or memoryview of unsigned 8-bit integers formatted as described in
wrapper.ndi_structs.FourCC
Note
This method is available for flexibility, but using
sender.Sender.write_video()orsender.Sender.write_video_async()may be more desirable as the video data will be buffered and sent immediately