cyndilib.framesync

FrameSync

class cyndilib.framesync.FrameSync

Bases: object

A wrapper around the NDI® frame synchronization module

When receiving streams, the frame sync methods in the NDI® library use various buffering and clock-timing techniques to keep video and audio data in sync with each other.

Timing “jitter” between capture calls is also accounted for which reduces the amount of critically-timed application code as compared to the direct approach needed for Receiver.

Note

Instances of this class are automatically created by the Receiver and therefore not intended to be created directly.

video_frame
Type:

VideoFrameSync

audio_frame
Type:

AudioFrameSync

audio_samples_available(self) int

Get the number of audio samples currently available for capture

capture_audio(self, no_samples: int) int

Capture available audio samples up to no_samples

After this call, the captured data will be available in the audio_frame

Returns the number of samples captured

capture_available_audio(self) int

Capture all available audio samples

After this call, the captured data will be available in the audio_frame

Returns the number of samples captured

capture_video(self, fmt: FrameFormat = FrameFormat.progressive)

Capture video

After this call, the captured data will be available in the video_frame

set_audio_frame(self, audio_frame: AudioFrameSync)

Set the audio_frame

set_video_frame(self, video_frame: VideoFrameSync)

Set the video_frame

FrameSyncThread

class cyndilib.framesync.FrameSyncThread(frame_sync, ft)

Bases: Thread

A thread designed for use with FrameSync

This can be used to handle video and audio using two separate threads. One thread would be set to use recv_video and the other to recv_audio.

Parameters:
worker

Either a VideoWorker or AudioWorker

Type:

FrameSyncWorker

remove_callback(self)
run(self)
set_callback(self, cb)

Set the callback

stop(self)

Stop the thread

FrameSyncWorker

class cyndilib.framesync.FrameSyncWorker

Bases: object

Worker for FrameSyncThread

frame_sync

The parent FrameSync instance

Type:

FrameSync

running

Current run state

Type:

bool

callback

Callback triggered when a new frame is available

Type:

Callback

target_fps

The target frame rate

Type:

float

target_interval

Interval between frames defined as \(1/F_r\)

Type:

float

frame_rate

The current frame rate

Type:

fractions.Fraction

VideoWorker

class cyndilib.framesync.VideoWorker

Bases: FrameSyncWorker

Worker used by FrameSyncThread for video frames

AudioWorker

class cyndilib.framesync.AudioWorker

Bases: FrameSyncWorker

Worker used by FrameSyncThread for audio frames