Skip to main content

A cython implementation of an ffmpeg based player.

Project description

FFPyPlayer is a python binding for the FFmpeg library for playing and writing media files.

For more information: http://matham.github.io/ffpyplayer/index.html

To install: http://matham.github.io/ffpyplayer/installation.html

TravisCI status Appveyor status Supported Python versions Latest Version on PyPI

Usage example

Playing a file:

>>> from ffpyplayer.player import MediaPlayer
>>> import time

>>> player = MediaPlayer(filename)
>>> val = ''
>>> while val != 'eof':
...     frame, val = player.get_frame()
...     if val != 'eof' and frame is not None:
...         img, t = frame
...         # display img

Writing a video file:

>>> from ffpyplayer.writer import MediaWriter
>>> from ffpyplayer.pic import Image

>>> w, h = 640, 480
>>> # write at 5 fps.
>>> out_opts = {'pix_fmt_in':'rgb24', 'width_in':w, 'height_in':h,
...     'codec':'rawvideo', 'frame_rate':(5, 1)}
>>> writer = MediaWriter('output.avi', [out_opts])

>>> # Construct image
>>> size = w * h * 3
>>> buf = bytearray([int(x * 255 / size) for x in range(size)])
>>> img = Image(plane_buffers=[buf], pix_fmt='rgb24', size=(w, h))

>>> for i in range(20):
...     writer.write_frame(img=img, pts=i / 5., stream=0)

Converting images:

>>> from ffpyplayer.pic import Image, SWScale
>>> w, h = 500, 100
>>> size = w * h * 3
>>> buf = bytearray([int(x * 255 / size) for x in range(size)])

>>> img = Image(plane_buffers=[buf], pix_fmt='rgb24', size=(w, h))
>>> sws = SWScale(w, h, img.get_pixel_format(), ofmt='yuv420p')

>>> img2 = sws.scale(img)
>>> img2.get_pixel_format()
'yuv420p'
>>> planes = img2.to_bytearray()
>>> map(len, planes)
[50000, 12500, 12500, 0]

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

ffpyplayer-4.1.0.tar.gz (71.0 kB view details)

Uploaded Source

Built Distributions

ffpyplayer-4.1.0-cp37-cp37m-win_amd64.whl (24.8 MB view details)

Uploaded CPython 3.7m Windows x86-64

ffpyplayer-4.1.0-cp37-cp37m-win32.whl (20.9 MB view details)

Uploaded CPython 3.7m Windows x86

ffpyplayer-4.1.0-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (12.6 MB view details)

Uploaded CPython 3.7m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

ffpyplayer-4.1.0-cp36-cp36m-win_amd64.whl (24.8 MB view details)

Uploaded CPython 3.6m Windows x86-64

ffpyplayer-4.1.0-cp36-cp36m-win32.whl (20.9 MB view details)

Uploaded CPython 3.6m Windows x86

ffpyplayer-4.1.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (12.6 MB view details)

Uploaded CPython 3.6m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

ffpyplayer-4.1.0-cp35-cp35m-win_amd64.whl (24.8 MB view details)

Uploaded CPython 3.5m Windows x86-64

ffpyplayer-4.1.0-cp35-cp35m-win32.whl (20.9 MB view details)

Uploaded CPython 3.5m Windows x86

ffpyplayer-4.1.0-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (12.6 MB view details)

Uploaded CPython 3.5m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

File details

Details for the file ffpyplayer-4.1.0.tar.gz.

File metadata

  • Download URL: ffpyplayer-4.1.0.tar.gz
  • Upload date:
  • Size: 71.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ffpyplayer-4.1.0.tar.gz
Algorithm Hash digest
SHA256 08760c186371a6a7aeec69616119b0e4c86b19de3930794272983b3737dbfcb9
MD5 6cad1e37d53970727f3f7554c23ad9c6
BLAKE2b-256 d672827ee3a519128ba6ea6e6714789435eefbadc03eef92d642f858bd64a313

See more details on using hashes here.

File details

Details for the file ffpyplayer-4.1.0-cp37-cp37m-win_amd64.whl.

File metadata

File hashes

Hashes for ffpyplayer-4.1.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 f6962e3bebe6c5e4a13bc9e00af7cc26e52002a347f93b8d34889ccdde967b4e
MD5 d4514689b2cf62544cdf924ce76fb7e1
BLAKE2b-256 d5d94ca00ee39cfd0294d35470d3b4cbf488490a53c78afe17e54feae33ceea0

See more details on using hashes here.

File details

Details for the file ffpyplayer-4.1.0-cp37-cp37m-win32.whl.

File metadata

File hashes

Hashes for ffpyplayer-4.1.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 781e54d9d000f6aa4add2c7564ae28b6a06462dce885f2cded7ee08d28596252
MD5 5aca11549f264f7ac6f05badf8904821
BLAKE2b-256 7423cb243292ce97f39ca54d7e2f49675e818d129e3313d16c1b6d8b377aed22

See more details on using hashes here.

File details

Details for the file ffpyplayer-4.1.0-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for ffpyplayer-4.1.0-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 89eb4d8ada60d617b21b7e3936413a8e8203ce44065d51e103ecb760a17289d5
MD5 1f0bd2a328e49921aaab77d698b8579e
BLAKE2b-256 ec04ed34cf937cd633e6f5623321ab909e21c4b4393a0509e8e16871bb3348e9

See more details on using hashes here.

File details

Details for the file ffpyplayer-4.1.0-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for ffpyplayer-4.1.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 5691094c6f00abf4412144c8cd33ee98efb426c2468d7dd00d1a975da36667bc
MD5 4f796aa2da35529ca20e11ef2fafec1b
BLAKE2b-256 5929b189aba6a46f4239d7496166cce469074eebb0cdeb217ea326900f6d1bd6

See more details on using hashes here.

File details

Details for the file ffpyplayer-4.1.0-cp36-cp36m-win32.whl.

File metadata

File hashes

Hashes for ffpyplayer-4.1.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 b6c9efb63750fdad63dee87150bfa71882a539654b719d40129bad27cab5b37b
MD5 6e65dc86b3b5f7deb84ad5ff5687ce2d
BLAKE2b-256 1580f9d6165238d762b901a6f442f2b35402f7638f51f16bca6599438ee01d60

See more details on using hashes here.

File details

Details for the file ffpyplayer-4.1.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for ffpyplayer-4.1.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 b1a88ec6c5743594516231740c9f21df448fc85958485cf54a457a460ea86efc
MD5 c508c28a5337e51146cc446e426a46b4
BLAKE2b-256 7cbed7431f90f2aa5063ae77c25608f7e29113dab9de898cd2345a4b749e4e87

See more details on using hashes here.

File details

Details for the file ffpyplayer-4.1.0-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for ffpyplayer-4.1.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 fbd57cda3fd776b27904dbdac70d8ce4f67d77b63afef9a3eb0c4ff8eeb93cd6
MD5 c5a74c4e33a69c433c652512ffcfdc9e
BLAKE2b-256 dbd51944a3b4fcb821e4b15f0ba5a27ec2b2ca29c8113c9a848fc5f43587b84f

See more details on using hashes here.

File details

Details for the file ffpyplayer-4.1.0-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for ffpyplayer-4.1.0-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 2406aaa259158683aa2dc9aaa79c17486670701a85f57858eba904d505700cba
MD5 e296d7907188341ec197fc9905b38fbd
BLAKE2b-256 269c66ca46b6e7b20ec566e4f43dd5ca571b24a8dd2fafc53ed9ae7fd922b81e

See more details on using hashes here.

File details

Details for the file ffpyplayer-4.1.0-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for ffpyplayer-4.1.0-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 661ccc5746e87e59e144993c43493618d2073177fd9871f079c982b3163409d6
MD5 7a0c42e8154e730c8cd7a602fcc47d91
BLAKE2b-256 b7a518da9c0b558271ad788ad9cf2e751a81c9222351177ef3dc85664df7d673

See more details on using hashes here.

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