Metadata-Version: 2.4
Name: pyvidplayer2
Version: 0.9.32
Summary: Reliable, easy, and fast video playback in Python with integrations for pygame, tkinter, pyglet, and more.
Author-email: Anray Liu <anrayliu@gmail.com>
Maintainer-email: Anray Liu <anrayliu@gmail.com>
License: MIT License
        
        Copyright (c) 2023 anrayliu
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/anrayliu/pyvidplayer2
Project-URL: Documentation, https://github.com/anrayliu/pyvidplayer2/blob/main/documentation.md
Project-URL: Repository, https://github.com/anrayliu/pyvidplayer2.git
Project-URL: Issues, https://github.com/anrayliu/pyvidplayer2/issues
Keywords: pygame,video,playback
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Multimedia :: Video
Classifier: Topic :: Multimedia :: Video :: Display
Classifier: Topic :: Software Development :: Libraries :: pygame
Classifier: Operating System :: OS Independent
Classifier: Typing :: Typed
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: opencv-python
Requires-Dist: pygame-ce
Requires-Dist: pysubs2
Requires-Dist: sounddevice
Provides-Extra: all
Requires-Dist: yt-dlp[default]; extra == "all"
Requires-Dist: decord; extra == "all"
Requires-Dist: imageio; extra == "all"
Requires-Dist: av; extra == "all"
Requires-Dist: pyglet; extra == "all"
Requires-Dist: PySide6; extra == "all"
Requires-Dist: PyQt6; extra == "all"
Requires-Dist: raylib; extra == "all"
Requires-Dist: wxPython; extra == "all"
Dynamic: license-file

![logo](logo.png)

[![PyPI Version](https://img.shields.io/pypi/v/pyvidplayer2?logo=pypi&logoColor=white)](https://pypi.org/project/pyvidplayer2/)
[![PyPI Downloads](https://static.pepy.tech/badge/pyvidplayer2)](https://pepy.tech/projects/pyvidplayer2)
[![Status](https://img.shields.io/pypi/status/pyvidplayer2)](https://pypi.org/project/pyvidplayer2/)
![Coverage](https://img.shields.io/badge/Coverage-96%25-red)
[![Python Version](https://img.shields.io/pypi/pyversions/pyvidplayer2?logo=python&logoColor=white)](https://pypi.org/project/pyvidplayer2/)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/anrayliu/pyvidplayer2)
[![Made with ❤️](https://img.shields.io/badge/Made_with-❤️-blue?style=round-square)](https://github.com/anrayliu/pyvidplayer2)

Comprehensive video playback library for Python.

This library is under active development. If you encounter a bug or a video that cannot be
played, please open an [issues page](https://github.com/anrayliu/pyvidplayer2/issues).

# Features

- Integrates easily with Pygame, PygameCE, Pyglet, Tkinter, PySide6, PyQT6, Raylib, or wxPython
- Full audio support
- Lean and modular
- Supports subtitle files
- Stream videos from Youtube
- Frame-by-frame iteration and inspection
- Built-in video player GUI

# Installation

```
pip install pyvidplayer2
```
In addition, FFmpeg and FFprobe must be downloaded and accessible via PATH.
Windows users can go to the [official website](https://www.ffmpeg.org/) 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-ce       (graphics and audio library, comes installed)
sounddevice     (better audio library, comes installed)
pysubs2         (for subtitles, comes installed)
yt_dlp          (for streaming Youtube videos)
decord          (for videos in bytes, best option)
imageio         (for videos in bytes)
av              (required for imageio)
pyglet          (graphics library)
PySide6         (graphics library)
PyQt6           (graphics library)
tkinter         (graphics library, installed as a system 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.

# Quickstart

Refer to the [examples](https://github.com/anrayliu/pyvidplayer2/tree/main/examples) folder for more basic examples.

## Pygame Integration

Refer to the [examples](https://github.com/anrayliu/pyvidplayer2/tree/main/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()
```

# Documentation

To get started quickly, you can browse the many [code examples](https://github.com/anrayliu/pyvidplayer2/tree/main/examples).
For more detailed information, read the [documentation](https://github.com/anrayliu/pyvidplayer2/blob/main/documentation.md).
If you prefer natural language, try asking [DeepWiki](https://deepwiki.com/anrayliu/pyvidplayer2). If you still have questions, 
open an [issues page](https://github.com/anrayliu/pyvidplayer2/issues).

# Known Bugs

For a list of known bugs, refer to [this page](https://github.com/anrayliu/pyvidplayer2/issues/53).
If you see an issue not listed, please open a new issue.
