A module to easily read frames from from a vide and display useful video information.
Project description
Description
frame_generator is a simple python package based on opencv to easily grab frames from a video files. #Features
- Creates a generator which iteratively yields the frames from a video file.
- Can skip pre-defined number of frames
- Can choose color mode of the yielded frame
- Allow you to display useful information about a video file. #Install
pip install frame_generator
#Usage
Reading frames from a video file
Note: the following script will show every 10th frame from the video.
from frame_generator import FrameGenerator
video_file = "PATH/TO/A/VIDEO/FILE"
fg = FrameGenerator(video_source=video_file,
show_video_info=True,
color_mode="BGR",
every_nth_frame=10)
for frame in fg:
do_something_with_frame(frame)
Parameters:
video_source: str
path to the frame_generator file you want to read.
show_video_info: bool
if true then frame_generator info is printed to the console
every_nth_frame: int
every nth frame will be yielded by the generator.
1 means that every single frame will be yielded.
color_mode: str, Optional
can be 'RGB', 'BGR' or 'Grayscale'
Getting and displaying video info
from frame_generator.video_info import get_video_info, prettify_video_info
video_file = "PATH/TO/A/VIDEO/FILE"
video_file, frame_count, fps, length, height, width = get_video_info(
video_file
)
print(prettify_video_info(video_file,
frame_count,
fps,
length,
height,
width))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
frame_generator-1.0.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for frame_generator-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1231900c5e44317259c4686cb54c3e3e742151b23975cd53913fb89fb78c44fc |
|
MD5 | b5e3d63c363b0b4396a0dda83ba3c2ce |
|
BLAKE2b-256 | ea11bd511a55517aae0a756548724afa98424d7f31c05cb7eb2090678284455c |