Skip to main content

pyvidplayer2

PyPI Version PyPI Downloads Status Coverage security: bandit Python Version from PEP 621 TOML Ask DeepWiki Made with ❤️

Featureful library for embedding videos into Python apps.

The latest version (v0.9.37) is a release candidate. This project currently uses pre-1.0 versioning in the form of 0.9.x. After v1.0, it will follow standard Semantic Versioning.

Features

  • Easy integration: Add a video to an existing app with just 4 lines of code
  • Lightweight: Almost every dependency is optional
  • Feature-rich: Seamless loops, custom playback speed, reverse playback, parallel playback, and more
  • Full audio support: Adjust audio track, output device, volume, and more
  • Full subtitle support: Parse subtitles from files or embedded subtitle tracks
  • Play any format: Supports almost every codec and container, VFR videos, even GIFs
  • YouTube integration: Stream videos and subtitles directly from YouTube
  • Low-level control: Frame-by-frame iteration and inspection
  • High compatibility: Integrates with 7 graphics libraries (some features limited to Pygame)
  • Extra features: Built-in video player GUI, post-processing effects, and webcam features

Installation

pip install pyvidplayer2

In addition, FFmpeg and FFprobe must be downloaded and accessible via PATH. Windows users can go to the official website to download FFmpeg (includes FFprobe). Add the bin folder location to the PATH environment variable. There's plenty of tutorials online for this. Linux and MacOS users can use their package manager of choice.

Legacy Installations

Versions prior to v0.9.31 have a PyAudio dependency. To build the wheel for it, some system packages must be present. Install them with your package manager before running pip install pyvidplayer2.

  • Ubuntu/Debian: sudo apt install python3-dev libjack-jackd2-dev portaudio19-dev
  • Fedora/RHEL: sudo dnf install python3-devel portaudio-devel
  • MacOS: brew install portaudio

Dependencies

numpy
FFmpeg and FFprobe (binaries, not Python packages)

Still requires one graphics library and one audio library of your choice.

Optional Packages

opencv_python       (efficiency improvements and more features, comes installed)
pygame/pygame-ce    (graphics and audio library)
sounddevice         (better audio library, comes installed)
pysubs2             (for subtitles)
yt_dlp[default]     (for streaming Youtube videos)
decord              (for videos in bytes, best option)
imageio[pyav]       (for videos in bytes)
pyglet              (graphics library)
PySide6             (graphics library)
PyQt6               (graphics library)
tkinter             (graphics library, installed as a sys package or with Python installer, not pip)
raylib              (graphics library)
wxPython            (graphics library)

Use pip install pyvidplayer2[all] to install all packages required for running the unit tests. Not required or recommended for regular users.

Documentation

Refer to this page for detailed information. To get started quickly, you can browse the many code examples. If you prefer natural language, try asking DeepWiki. If you still have questions, open an issues page.

Quickstart

Refer to the examples folder for more basic examples.

Pygame Integration

Refer to the examples folder for integrations with other graphics libraries.

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 vid.active:
    key = None
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            vid.stop()
        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/play video
    elif key == "m":
        vid.toggle_mute()       # Mute/unmute 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)


# Close video when done

vid.close()
pygame.quit()

Metadata

Release files for pyvidplayer2 0.9.37

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyvidplayer2 0.9.37
File Size Uploaded Provenance Actions
pyvidplayer2-0.9.37.tar.gz 66.3 kB With provenance Details for pyvidplayer2-0.9.37.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyvidplayer2 0.9.37
File Interpreter ABI Platform Actions
pyvidplayer2-0.9.37-py3-none-any.whl Python 3 none any Details for pyvidplayer2-0.9.37-py3-none-any.whl

Total release size: 116.1 kB

Release files / pyvidplayer2-0.9.37.tar.gz

Download URL pyvidplayer2-0.9.37.tar.gz
Size 66.3 kB
Tags Source
SHA-256 checksum
How to use checksums
39b9f5a77892d9a76f025f02e1a10db82b0a91c51ef1c51d184b8c41623f78e4
BLAKE2b-256 checksum
How to use checksums
68f7782d1c7e9c43347ee2cc2df4a3f1db9483775386e7da4143bc700e497744
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / pyvidplayer2-0.9.37-py3-none-any.whl

Download URL pyvidplayer2-0.9.37-py3-none-any.whl
Size 49.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
270ee6a7fc632bee1018d3a4bee4f591ba6ecd5c2b5241387741aff90f5d0334
BLAKE2b-256 checksum
How to use checksums
dae4118bc40f1cc8f910f406ee4122e97e69b88af051dec51714bc7bede230e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Security for pyvidplayer2 0.9.37

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyvidplayer2-0.9.37.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.9.37 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page