Skip to main content

a simple video player written in python using ffpyplayer and OpenCV

Project description

Video Player

cvplayer is a minimal wrapper around the ffpyplayer.MediaPlayer class for playing videos through

  • interactive (direct access to the player through keymaps) or
  • scripts (getting a VideoPlayer instance and doing whatever the user wants to)

audio playback and supplying frames is handles by ffpyplayer and OpenCV is used to display the frames

this makes it useful for simple interactable video playback as well for integrating video playback in programs

Scripted access


cvplayer provides the VideoPlayer class which is the main wrapper around the ffpyplayer.
Initializing a VideoPlayer instance will start playing the video according to the options specified while initializing. The Playback can be controlled from within the script as well as using keymaps.

the VideoPlayer class

this class initiates playback and provide methods to control/access the state of the player.

parameters:

   filename: str
      the filename of the media to be played

Here's and example to play a video

from cvplayer import VideoPlayer

player = VideoPlayer(filename)

duration = int(player.get_metadata()['duration'])
while player.state != 'eof':
    print(player.get_pts())
    time.sleep(1)

Project details


Download files

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

Source Distribution

cvplayer-1.1.0.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

cvplayer-1.1.0-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

Supported by

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