ffpyplayer 4.5.3


pip install ffpyplayer

  Latest version

Released: Jun 11, 2025

Project Links

Meta
Author: Matthew Einhorn

Classifiers

License
  • OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)

Topic
  • Multimedia :: Video
  • Multimedia :: Video :: Display
  • Multimedia :: Sound/Audio :: Players
  • Multimedia :: Sound/Audio :: Players :: MP3

Programming Language
  • Python :: 3.7
  • Python :: 3.8
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13

Operating System
  • MacOS :: MacOS X
  • Microsoft :: Windows
  • POSIX :: BSD :: FreeBSD
  • POSIX :: Linux

Intended Audience
  • Developers

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

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

To install: https://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]

Wheel compatibility matrix

Platform CPython 3.9 CPython 3.10 CPython 3.11 CPython 3.12 CPython 3.13
macosx_10_13_universal2
macosx_10_13_x86_64
macosx_11_0_arm64
manylinux2014_aarch64
manylinux2014_x86_64
manylinux_2_17_aarch64
manylinux_2_17_x86_64
win_amd64

Files in release

ffpyplayer-4.5.3-cp310-cp310-macosx_10_13_universal2.whl (36.5MiB)
ffpyplayer-4.5.3-cp310-cp310-macosx_10_13_x86_64.whl (19.4MiB)
ffpyplayer-4.5.3-cp310-cp310-macosx_11_0_arm64.whl (17.2MiB)
ffpyplayer-4.5.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (26.5MiB)
ffpyplayer-4.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28.3MiB)
ffpyplayer-4.5.3-cp310-cp310-win_amd64.whl (58.2MiB)
ffpyplayer-4.5.3-cp311-cp311-macosx_10_13_universal2.whl (36.5MiB)
ffpyplayer-4.5.3-cp311-cp311-macosx_10_13_x86_64.whl (19.4MiB)
ffpyplayer-4.5.3-cp311-cp311-macosx_11_0_arm64.whl (17.2MiB)
ffpyplayer-4.5.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (26.8MiB)
ffpyplayer-4.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28.6MiB)
ffpyplayer-4.5.3-cp311-cp311-win_amd64.whl (58.2MiB)
ffpyplayer-4.5.3-cp312-cp312-macosx_10_13_universal2.whl (36.5MiB)
ffpyplayer-4.5.3-cp312-cp312-macosx_10_13_x86_64.whl (19.4MiB)
ffpyplayer-4.5.3-cp312-cp312-macosx_11_0_arm64.whl (17.2MiB)
ffpyplayer-4.5.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (26.8MiB)
ffpyplayer-4.5.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28.6MiB)
ffpyplayer-4.5.3-cp312-cp312-win_amd64.whl (58.2MiB)
ffpyplayer-4.5.3-cp313-cp313-macosx_10_13_universal2.whl (36.5MiB)
ffpyplayer-4.5.3-cp313-cp313-macosx_10_13_x86_64.whl (19.4MiB)
ffpyplayer-4.5.3-cp313-cp313-macosx_11_0_arm64.whl (17.2MiB)
ffpyplayer-4.5.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (26.8MiB)
ffpyplayer-4.5.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28.5MiB)
ffpyplayer-4.5.3-cp313-cp313-win_amd64.whl (58.2MiB)
ffpyplayer-4.5.3-cp39-cp39-macosx_10_13_universal2.whl (36.5MiB)
ffpyplayer-4.5.3-cp39-cp39-macosx_10_13_x86_64.whl (19.4MiB)
ffpyplayer-4.5.3-cp39-cp39-macosx_11_0_arm64.whl (17.2MiB)
ffpyplayer-4.5.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (26.6MiB)
ffpyplayer-4.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28.3MiB)
ffpyplayer-4.5.3-cp39-cp39-win_amd64.whl (58.2MiB)
ffpyplayer-4.5.3.tar.gz (87.0KiB)
No dependencies