Video playback in Python
Project description
pyvidplayer2
Introducing pyvidplayer2, the successor to pyvidplayer. It's better in pretty much every way, and finally allows an easy and reliable way to play videos in Python.
All the features from the original library have been ported over, with the exception of alt_resize()
. Since pyvidplayer2 has a completely revamped foundation, the unreliability of set_size()
has been quashed, and a fallback function is now redundant.
Features
- Easy to implement
- Reliable playback
- Fast load times
- No audio/video sync issues
- Low cpu usage
- Subtitle support
- Play multiple videos in parallel
- Built in GUI
- Support for Pygame, Pyglet, Tkinter, and PyQT6
- Can play all ffmpeg supported video formats
- Post process effects
Installation
pip install pyvidplayer2
Note: FFMPEG must be installed and accessible via PATH.
Quickstart
Refer to the examples folder for more basic guides, and documentation.md contains more detailed information.
import pygame
from pyvidplayer2 import Video
# create video object
vid = Video("video.mp4")
win = pygame.display.set_mode(vid.current_size)
pygame.display.set_caption(vid.name)
while True:
key = None
for event in pygame.event.get():
if event.type == pygame.QUIT:
vid.close()
pygame.quit()
exit()
elif event.type == pygame.KEYDOWN:
key = pygame.key.name(event.key)
if key == "r":
vid.restart() #rewind video to beginning
elif key == "p":
vid.toggle_pause() #pause/plays video
elif key == "right":
vid.seek(15) #skip 15 seconds in video
elif key == "left":
vid.seek(-15) #rewind 15 seconds in video
elif key == "up":
vid.set_volume(1.0) #max volume
elif key == "down":
vid.set_volume(0.0) #min volume
# only draw new frames, and only update the screen if something is drawn
if vid.draw(win, (0, 0), force_draw=False):
pygame.display.update()
pygame.time.wait(16) # around 60 fps
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 pyvidplayer2-0.9.1.tar.gz
.
File metadata
- Download URL: pyvidplayer2-0.9.1.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b961a44b9d07cc4384700eb05a27094b5e9f2af7e4816505bcf84e0eb9e4c81 |
|
MD5 | 260cfc4eba8e1c82bec23db1e338202f |
|
BLAKE2b-256 | 7e473f4f415d616db1037b6444dc853128b1f553821d43f5a790c7189ace0b6b |
File details
Details for the file pyvidplayer2-0.9.1-py3-none-any.whl
.
File metadata
- Download URL: pyvidplayer2-0.9.1-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56f68249e647ef1f95b4c87701214669bb55d5f6c977f25dfd1d9982a623c2f1 |
|
MD5 | 76ca532019c114c96db909dcba4bc457 |
|
BLAKE2b-256 | 16390c37c5d55a534f6610d00b0da9fe58c2efbe15c960b6704b8f335b5e272e |