Skip to main content

A borderless video player with sound

Reason this release was yanked:

Doesn't manage temp files

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bvPlayer-0.1.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

bvPlayer-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file bvPlayer-0.1.0.tar.gz.

File metadata

  • Download URL: bvPlayer-0.1.0.tar.gz
  • Upload date:
  • Size: 5.8 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

Hashes for bvPlayer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8285575438511e7b2cd604db81530c4a29c71f36d14dfc1b7eaa56df69abdc29
MD5 ede1d5f4efdbd8e097eff9d641be4d67
BLAKE2b-256 cb2760893b2c8ba68cca24058d3daa252e47efc24c223ca39dff38d442e81307

See more details on using hashes here.

File details

Details for the file bvPlayer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bvPlayer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 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

Hashes for bvPlayer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59b7b21a42a654b1ea1990c00ebf95e71eb4344f9d6c3bba33cfd298b8c4cfc5
MD5 f137bd0ab3e0e9be059b005755d7903f
BLAKE2b-256 555fde46c5a4252971de9dacbabe53c0a54800cb508627228289b3007862b8aa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page