Skip to main content

Video playback widgets & controls for Textual (textual-image based)

Project description

textual-video

Textual widget for playing videos in terminal UIs. Based on textual-image.

[!WARNING] This project is freezed/archived due i have no time. Maybe will continue work in summer.

Installation

PyPI release soon. Now just clone repo.

Dependencies

  • textual
  • textual-image
  • av
  • numpy

Usage

from textual_video.player import VideoPlayer
from textual.app import App, ComposeResult

class ExampleApp(App):
    def compose(self) -> ComposeResult:
        yield VideoPlayer(r'examples\video.mp4')

if __name__ == '__main__':
    ExampleApp().run()

Parameters

Name Type Description
path str Path to the video file
image_type ImageType Rendering backend (e.g. ImageType.SIXEL)
speed float Playback speed multiplier (1.0 = normal)
update_strategy UpdateStrategy How frames are updated (REPLACE_WIDGET or UPDATE_IMAGE)
fps_decrease_factor int Downsample FPS by this factor to reduce CPU/rendering load

Enums

ImageType

Image rendering type

Member Description
ImageType.SIXEL Highest fidelity; requires terminal sixel support.
ImageType.TGP Mid-quality option (depends on implementation).
ImageType.HALFCELL Fast; uses half-cell Unicode blocks.
ImageType.UNICODE Fastest; low fidelity, widest compatibility.

UpdateStrategy

Image updating strategy

Member Description
UpdateStrategy.REMOUNT Create/mount a new widget for each frame and remove the old. Simple but slow and can flicker.
UpdateStrategy.REACTIVE Update a reactive field on the player and call refresh(recompose=True). Medium cost.
UpdateStrategy.SET_IMAGE Keep one mounted widget and call image setter. Supports only ImageType.SIXEL

FAQ

  1. Video does not start from the beginning, but from the middle or from the end
  • Try incrase fps_decrease_factor - your terminal can't cope with frequent changes (escpecially with ImageType.SIXEL)
  • Change ImageType to more faster (like HALFCELL)
  1. Video lagging (has black gaps between update)
  • Use UpdateStrategy.REACTIVE
  • Change ImageType to more faster
  1. Is there any ways to provide customer control?
  • Сreate a new class inheriting from textual_video.controls.PlayerControls and provide it in control argument in VideoPlayer

Contributing

  • Please open issues for bugs or feature requests.
  • Create a PR against main and mention related issues.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

textual_video-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: textual_video-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for textual_video-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00c89ba9801ee57f5084e88b7b3af121250aa17ebcc4b64241bde7a480a5d3cd
MD5 9b3d4b184d5eb32816b5e31bb7e184ef
BLAKE2b-256 6f12bd3562d633f966d4e15d5e261c61e245cfe2c1c4c63879d4a6b93e9a5ace

See more details on using hashes here.

Supported by

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