pyvidplayer2


Namepyvidplayer2 JSON
Version 0.9.13 PyPI version JSON
download
home_pagehttps://github.com/ree1261/pyvidplayer2
SummaryVideo playback in Python
upload_time2024-04-06 02:53:44
maintainerNone
docs_urlNone
authorAnray Liu
requires_python>=3.10
licenseMIT
keywords pygame video playback
VCS
bugtrack_url
requirements numpy opencv_python pygame pysubs2 PyAudio
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyvidplayer2 (please report all bugs!)
Languages: English | [中文](https://github.com/anrayliu/pyvidplayer2/blob/main/README.cn.md)


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 (tested on Windows)
- Easy to implement (4 lines of code)
- Fast and reliable
- Adjust playback speed
- No audio/video sync issues
- Subtitle support (.srt, .ass, etc)
- 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
- Webcam feed

# Installation
```
pip install pyvidplayer2
```
Note: FFMPEG (just the essentials is fine) must be installed and accessible via the system PATH. Here's an online article on how to do this (windows):
https://phoenixnap.com/kb/ffmpeg-windows.

# 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 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/plays video
    elif key == "m":
        vid.toggle_mute()       #mutes/unmutes 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
    elif key == "1":
        vid.set_speed(1.0)      #regular playback speed
    elif key == "2":
        vid.set_speed(2.0)      #doubles video speed

    # 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


# close video when done

vid.close()
pygame.quit()

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ree1261/pyvidplayer2",
    "name": "pyvidplayer2",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "pygame, video, playback",
    "author": "Anray Liu",
    "author_email": "anrayliu@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5c/74/0caf8605a0cc9080a030b3019ef8d1df8b7f79591dc2c7f6036733a83d03/pyvidplayer2-0.9.13.tar.gz",
    "platform": "windows",
    "description": "# pyvidplayer2 (please report all bugs!)\r\nLanguages: English | [\u00e4\u00b8\u00ad\u00e6\u2013\u2021](https://github.com/anrayliu/pyvidplayer2/blob/main/README.cn.md)\r\n\r\n\r\nIntroducing pyvidplayer2, the successor to pyvidplayer. It's better in\r\npretty much every way, and finally allows an easy and reliable way to play videos in Python.\r\n\r\nAll 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.\r\n\r\n# Features (tested on Windows)\r\n- Easy to implement (4 lines of code)\r\n- Fast and reliable\r\n- Adjust playback speed\r\n- No audio/video sync issues\r\n- Subtitle support (.srt, .ass, etc)\r\n- Play multiple videos in parallel\r\n- Built in GUI\r\n- Support for Pygame, Pyglet, Tkinter, and PyQT6\r\n- Can play all ffmpeg supported video formats\r\n- Post process effects\r\n- Webcam feed\r\n\r\n# Installation\r\n```\r\npip install pyvidplayer2\r\n```\r\nNote: FFMPEG (just the essentials is fine) must be installed and accessible via the system PATH. Here's an online article on how to do this (windows):\r\nhttps://phoenixnap.com/kb/ffmpeg-windows.\r\n\r\n# Quickstart\r\n\r\nRefer to the examples folder for more basic guides, and documentation.md contains more detailed information.\r\n\r\n```\r\nimport pygame\r\nfrom pyvidplayer2 import Video\r\n\r\n\r\n# create video object\r\n\r\nvid = Video(\"video.mp4\")\r\n\r\nwin = pygame.display.set_mode(vid.current_size)\r\npygame.display.set_caption(vid.name)\r\n\r\n\r\nwhile vid.active:\r\n    key = None\r\n    for event in pygame.event.get():\r\n        if event.type == pygame.QUIT:\r\n            vid.stop()\r\n        elif event.type == pygame.KEYDOWN:\r\n            key = pygame.key.name(event.key)\r\n    \r\n    if key == \"r\":\r\n        vid.restart()           #rewind video to beginning\r\n    elif key == \"p\":\r\n        vid.toggle_pause()      #pause/plays video\r\n    elif key == \"m\":\r\n        vid.toggle_mute()       #mutes/unmutes video\r\n    elif key == \"right\":\r\n        vid.seek(15)            #skip 15 seconds in video\r\n    elif key == \"left\":\r\n        vid.seek(-15)           #rewind 15 seconds in video\r\n    elif key == \"up\":\r\n        vid.set_volume(1.0)     #max volume\r\n    elif key == \"down\":\r\n        vid.set_volume(0.0)     #min volume\r\n    elif key == \"1\":\r\n        vid.set_speed(1.0)      #regular playback speed\r\n    elif key == \"2\":\r\n        vid.set_speed(2.0)      #doubles video speed\r\n\r\n    # only draw new frames, and only update the screen if something is drawn\r\n    \r\n    if vid.draw(win, (0, 0), force_draw=False):\r\n        pygame.display.update()\r\n\r\n    pygame.time.wait(16) # around 60 fps\r\n\r\n\r\n# close video when done\r\n\r\nvid.close()\r\npygame.quit()\r\n\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Video playback in Python",
    "version": "0.9.13",
    "project_urls": {
        "Homepage": "https://github.com/ree1261/pyvidplayer2"
    },
    "split_keywords": [
        "pygame",
        " video",
        " playback"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3fd663c955bcbce29062232dc92e7c7d972e2b506d37b5d9706cfbf73835c6db",
                "md5": "2100fbdec53a350e96f5095bd33d78e5",
                "sha256": "3433110c8b573b82bad01fad81e7bbd9e8571e51bdeed0116c5c923239ba0469"
            },
            "downloads": -1,
            "filename": "pyvidplayer2-0.9.13-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2100fbdec53a350e96f5095bd33d78e5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 17225,
            "upload_time": "2024-04-06T02:53:43",
            "upload_time_iso_8601": "2024-04-06T02:53:43.092196Z",
            "url": "https://files.pythonhosted.org/packages/3f/d6/63c955bcbce29062232dc92e7c7d972e2b506d37b5d9706cfbf73835c6db/pyvidplayer2-0.9.13-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5c740caf8605a0cc9080a030b3019ef8d1df8b7f79591dc2c7f6036733a83d03",
                "md5": "87a43fdddef6d85fca96fa6be0c54052",
                "sha256": "bdfcaeebf112d5ab2e0f3ed039586f0f17087da9f66f10a13b7bf0d8bf74a12d"
            },
            "downloads": -1,
            "filename": "pyvidplayer2-0.9.13.tar.gz",
            "has_sig": false,
            "md5_digest": "87a43fdddef6d85fca96fa6be0c54052",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 13640,
            "upload_time": "2024-04-06T02:53:44",
            "upload_time_iso_8601": "2024-04-06T02:53:44.117036Z",
            "url": "https://files.pythonhosted.org/packages/5c/74/0caf8605a0cc9080a030b3019ef8d1df8b7f79591dc2c7f6036733a83d03/pyvidplayer2-0.9.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-06 02:53:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ree1261",
    "github_project": "pyvidplayer2",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "opencv_python",
            "specs": []
        },
        {
            "name": "pygame",
            "specs": []
        },
        {
            "name": "pysubs2",
            "specs": []
        },
        {
            "name": "PyAudio",
            "specs": []
        }
    ],
    "lcname": "pyvidplayer2"
}
        
Elapsed time: 0.23803s