A lightweight OpenCV video player designed to facilitate frame analysis. It features real-time on-screen data including timestamp, frame index, and playback performance.
import cv2 as cv
from video_player import VideoPlayer, LSize
player = VideoPlayer('../videos/5911716-hd_1920_1080_25fps.mp4')
player.resize(LSize.SD)
player.run()- Resize OpenCV windows to SD, HD, or FHD resolutions (landscape or portrait).
Example:
player.resize(LSize.SD). - Callback support to handle external routines.
Example:
player.run(lambda image: cv.cvtColor(image, cv.COLOR_BGR2GRAY)). - Start video playback from a specific timestamp.
Example:
player.run(start=1000).
- SPACE: play or pause the video.
- ⬅️/➡️: step one frame backward or forward.
- ⬇️/⬆️: jump to first or last frame.
- Video by cottonbro studio from Pexels: https://www.pexels.com/video/man-in-denim-jacket-riding-his-fixie-bicycle-passing-by-5911716/. It's free to use.
