Helper functions
Utility functions and helpers.
FpsTracker
Utility class to track frames per second.
Use tracker.tick()
once per update (e.g., per frame). The tracker
stores the time differences (dt) between successive tick
calls.
You can then get the current estimate of FPS through the tracker.fps
property.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
maxlen |
number of time differences to use for FPS calculation. Defaults to 30. |
30
|
Source code in src\yarppg\helpers.py
fps: float
property
Frames per second calculated from average time difference between updates.
bpm_from_frames_per_beat(hr, fps)
frames_from_video(filename)
Read and yield frames from a video file.
get_cached_resource_path(filename, url, reload=False)
Download a file from the web and store it locally.
Source code in src\yarppg\helpers.py
get_video_fps(filename)
Find the frame rate of the given video file.