A borderless video player with sound
Reason this release was yanked:
Doesn't manage temp files well
Project description
bvPlayer
A borderless video player for python. Comes with a variety of functions such as audio synchronization, FPS adjustment, video scaling, window dragging, and menu options.
Audio synchronization is done through frame skipping and frame delaying. Fps adjustments is done through randomly selecting frames within small chunks. The user is limited to an approximation of their input fps, this is to make the video look smoother.
Resources
This package was implemented with:
- opencv, for frame loading from a video file
- Pillow, for displaying images on tkinter
- ffpyplayer, for audio synchronization
Installation
- Download the repository and run
setup.py
git clone https://github.com/jwcarlson01/bvPlayer.git
python bvPlayer/setup.py
- Install from PyPI
pip install bvPlayer
Usage
- import the bvPlayer package and class
from bvPlayer import bvPlayer
- call the class with a filename and optional arguments
bvPlayer("file.mp4")
The video will play upon the class declaration.
Optional Arguments
If optional arguments are not specified, the video will default to its orginal fps, (0,0) position on the screen, non-draggable, its original dimensions, and no videoOptions.
- fps, to change the display fps to a number less than the file fps
fps = float
- pos, to change the start-up display location on the screen
pos = (int x, int y)
- draggable, to make the window draggable
draggable = bool
- dim, to scale the video output to a desired dimension
dim = (int w, int h)
- videoOptions, to enable options when right clicking the video, includes quit and restart
videoOptions = bool
Example
from bvPlayer import bvPlayer
bvPlayer("file.mp4", draggable = True, fps = 28, dim = (854, 480))
Performance
There are two approaches to playing a video on tkinter, either to pregenerate images in a folder and read those images after onto tkinter, or to dynamically load images and display them at the same time.
bvPlayer uses the dynamic approach. bvPlayer uses opencv to load images into temporary files. These temp files are then read by Pillow to be displayed on tkinter. Naturally there is a heavy performance loss using the dynamic approach. bvPlayer uses one thread to read frames, two threads to write frames to temp files, and one thread to display the video and play the audio.
bvPlayer will run a 1080p video on a low end CPU at 20 fps, while using about 60-100% of the CPU. A 480p video will run at 45 fps, using about 40-80% of the CPU; and a 360p video will run at 65 fps, using about 20-60% of the CPU.
bvPlayer keeps only a small number of frames loaded in RAM, so when running a 1080p video it uses less than 200 MB of RAM.
bvPlayer writes its images to temp files, therefore it uses the disk. Expect at most 5MB/s at 1080p.
Contact
I'm always open for suggestions. View the issues page for issues.
Joshua Carlson - joshuacarlson@cedarville.edu
Readme inspired by tkvideo
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
Built Distribution
File details
Details for the file bvPlayer-0.3.2.tar.gz
.
File metadata
- Download URL: bvPlayer-0.3.2.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.3 tqdm/4.51.0 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e82b0dbe5238df76b333254dadde87bb70908af3dfa2ccb798a029e9279ac49c |
|
MD5 | 5ac3f613ec8fc16b76f5d42e1f5d127f |
|
BLAKE2b-256 | e8a211d704b209ff65613b0802359fa02e5a6c6081ddc0f9b10b70f56ead9800 |
File details
Details for the file bvPlayer-0.3.2-py3-none-any.whl
.
File metadata
- Download URL: bvPlayer-0.3.2-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.3 tqdm/4.51.0 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d83ffbbd70a5e601fa09592eea02b847a26cf3817947397e4ec9d7d46745321c |
|
MD5 | 113fefe0c4ea63962fd2f4927f2a9170 |
|
BLAKE2b-256 | 75239d564e3839cb35d3c0bcd3596063d449f35205090b5df53ec80b5b4d1c64 |