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
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
Release history Release notifications | RSS feed
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.3.0.tar.gz
(84.4 kB
view hashes)
Built Distributions
Close
Hashes for ffpyplayer-4.3.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4384e1fde12c73f4182118e152e8d4c37cba1bde74b7a2ea25d36d608d46839 |
|
MD5 | ba97b3041525beed4002788db288a208 |
|
BLAKE2b-256 | 1a79957f8dc6ee5d89567e8e133f401a5b91866275dd679b1d41438b656c0c20 |
Close
Hashes for ffpyplayer-4.3.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a80f5e29990818dcbef9d5a3844a3ee9320bb408c06e61f77a048a786139ba0d |
|
MD5 | ba8840557c17607b606b3d75c42e797a |
|
BLAKE2b-256 | aa391891376fc9d3225e72f421f7fe196aae74a79856527dd551c5dd1653a07a |
Close
Hashes for ffpyplayer-4.3.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f712c4899bf7cd73b5e92a2f1160a078ec971a890ec76a84533cd455298c7473 |
|
MD5 | 8e08ceb209bb7df3f33c2f4ccc8dbd35 |
|
BLAKE2b-256 | c0cdec441a69d9ea035d561b850ef7c7a001c6197e3b608a912f724c680b94a5 |
Close
Hashes for ffpyplayer-4.3.0-cp38-cp38-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 269fc32e8eee8ef05b44c2b0b11cccbfc03e8f31567d4b049ea7f6d10b8619ad |
|
MD5 | 78f6bda1aca7802d945abdad5290cb1a |
|
BLAKE2b-256 | ee8503d56b288bcbc8a19867601d76e43ae640f4e267bb7cf8f4e1d1b9e9ee56 |
Close
Hashes for ffpyplayer-4.3.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5410a2b0a0e76c9ee66fe044b98a51f8d6ffd2fb122c0c1e1ff324820a65eaab |
|
MD5 | 2f1553570d3a71983151197bc25d1474 |
|
BLAKE2b-256 | aac4412c25b87dc68bef5ad45a9d03548cc4ee513a6dc7a3d59a700e7e9b5e9d |
Close
Hashes for ffpyplayer-4.3.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e666cab5dfd98216cf1196293a759082074da6fb22e7286de47ee1a367c029d0 |
|
MD5 | cc3e771132afd06563403e3e2b2484e1 |
|
BLAKE2b-256 | 9a1dcccfebdde1f3f632e1257df24c8b5e3742eb0009a9591045f392001ad986 |
Close
Hashes for ffpyplayer-4.3.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88e1f234c9eb6f288c0f136427e79095ec29e9a6a01168dfb65d199f482254e3 |
|
MD5 | 78b0b10000f9943c2c6571d475d924d8 |
|
BLAKE2b-256 | eb3b6d54e8a2ea2f84c7a51d41d52cac5c257cef6bf17fddaf75fd97b3f5dfad |
Close
Hashes for ffpyplayer-4.3.0-cp37-cp37m-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47f43cd95367aa7922eacc001d2e5c8b30fefb68c545b502b4be7201e9bf2a4f |
|
MD5 | 904ccc62b378e5f95e63e468700fd3ac |
|
BLAKE2b-256 | 4e168465de266a64d369a3625755714829fe61ea334b34142723dbf1c6b76b0f |
Close
Hashes for ffpyplayer-4.3.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 229bde549e034680436c69712b494b79ea320da3c6e23b07f3b431189d95b539 |
|
MD5 | 4b1f4c23266a5ac6801b0621e304e7a8 |
|
BLAKE2b-256 | f7b4d1cfe90bdd762601f642155421990f3fa2edde2f8500df4aa8e5753af800 |
Close
Hashes for ffpyplayer-4.3.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55e437ad3c8b99ba67a158b30cf990e7f358d5de9bde5877eec084e222a368b2 |
|
MD5 | 6709a4fc333cf141c136d72e31abc8c3 |
|
BLAKE2b-256 | 6a02d67a1a32411c934a1c5e0ab4286de800b15e9035d1e2d5b150bb06e803ab |
Close
Hashes for ffpyplayer-4.3.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43d21437737ae3c177b5a70f57814ff9be6b06eb868fe7ed5f439f77f1d12c99 |
|
MD5 | 97fea57e4f18e165a3bbbb767b24a951 |
|
BLAKE2b-256 | a8524bdd1945fc7045d2b86f9eec63ba6aa536e04a1a14983f6bf18e0e1ca286 |
Close
Hashes for ffpyplayer-4.3.0-cp36-cp36m-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fe4939f952db3625bd32eaae635e993da1dd0c92bdeb33e2b67c905da8f212b |
|
MD5 | 051f6b3b76151d3d86e74ab88fc3afe9 |
|
BLAKE2b-256 | db4914673a14d9ea177d386189c4efee8b94f86c88895d6f009f3dc8060b983b |
Close
Hashes for ffpyplayer-4.3.0-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa8db7a9e1fce33f92dbf28bc6ee65ba2eb0e94ee14ca85bbf04ae176ac323df |
|
MD5 | 282d8441b5812d12ee8412cdbbcc7244 |
|
BLAKE2b-256 | 49c8e7919c6840e75069ba66aedef35197c4b03923933e3dd3b5e1626a15f2be |