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: https://matham.github.io/ffpyplayer/index.html
To install: https://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.4.0.tar.gz
(88.9 kB
view hashes)
Built Distributions
Close
Hashes for ffpyplayer-4.4.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 424440ad325df1981e50017ac39d819cc51155045664e40eadefca1f0f950561 |
|
MD5 | 3badabdb583585c39a26ff0e717c2a27 |
|
BLAKE2b-256 | 9452205146ab25f0e28164f0a02e941933eb6de7f362f44fb95011b8a7bf0185 |
Close
Hashes for ffpyplayer-4.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5881c759179469a0ce3b5cf5f1178b3c925519f1b211e9a84c870a105fb37fb8 |
|
MD5 | 723811a74fab43c01270e56a594c89bf |
|
BLAKE2b-256 | 36267d02e013b57948790af7b806c4748f4c484b5c2c34e7abc27202e6d847a5 |
Close
Hashes for ffpyplayer-4.4.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34598bbb11d30e08714d4dac9cdacd2545556811e171311978f59b52bcbeb7f9 |
|
MD5 | 85efa69b004e82a84b5573a609018b1e |
|
BLAKE2b-256 | e2eafc8fe333b24b44ac58a2d44d24cd1b3c52b0ca2b637b57b00f2864a58851 |
Close
Hashes for ffpyplayer-4.4.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0203dd4ef0b885ece45aaedc7bdf7b1c4c7c3d8f33907266262b6d3cfb5c8edf |
|
MD5 | d0416255b3e53648e042f468b9651179 |
|
BLAKE2b-256 | 49db92d26fafc151a766662c80c57ebba38aaa9108f7542e5fc6fb260a65f905 |
Close
Hashes for ffpyplayer-4.4.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0b7a93555bae413326a8999d1084a6ccb4a06eac5bf59ccb26a1019324d0821 |
|
MD5 | c0537761824585beace4be0d5d1f6c22 |
|
BLAKE2b-256 | fae8414d7989793cd0ee1c28a67ae78bced6f05d67f4dc2b390a112eeff4b50e |
Close
Hashes for ffpyplayer-4.4.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d350f482831d1e6aee9ae553bd52e7ee8783d40541a58628a33b1491512d720 |
|
MD5 | 1f33241f2b78f545d4111be68ef0e2e1 |
|
BLAKE2b-256 | 5197e4cad787aa28ac76790bdd7107529256ff0c57aafe832f53aba00fb622fc |
Close
Hashes for ffpyplayer-4.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a886c52c16c50cc8074b8938d7f8b45a213d6f60d95ba1a10e43dd1da9dfdeb |
|
MD5 | 1046fc60b44af194168203b3c4942460 |
|
BLAKE2b-256 | ab217bb8af7bc464a6a73ac1a15ab6cec543342837106286c9c7824684c5e6d3 |
Close
Hashes for ffpyplayer-4.4.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | befff7dbb1386af783e8bb06bf291fd660ff169ca5e0d960681e7139f7a584ec |
|
MD5 | 9c8dcaab4f2c283197b39e49e21744d3 |
|
BLAKE2b-256 | ca46131e9fc9e85e807ebc5e960c31b9a761b31b9d4bd29ca36923e19b05caeb |
Close
Hashes for ffpyplayer-4.4.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6ce70fe589c993ca7f2e4e3461cc9bb6274cba598233aa8efbd0c259301f307 |
|
MD5 | 556651b2e38f5fad963f67c326711f02 |
|
BLAKE2b-256 | 28ee0e5c40140c342f8dc3ca91b6756c07f632db01f4735ed9833fe6d1c0e413 |
Close
Hashes for ffpyplayer-4.4.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6dbd2ea77f2f38b9fbaa3015aa98284d1ff11867e0660731bf721b08e0d6f5ac |
|
MD5 | 30348c9b94fcd868a1cfd253429928c3 |
|
BLAKE2b-256 | c5e98eea2ac6f5a4c1dd32d497071b76fba12d2c5258aec9112ec767f8dc2181 |
Close
Hashes for ffpyplayer-4.4.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9b4909d472f895b9af0be280d84ceb00ff3f20d589dba4d63a5553d94f70e84 |
|
MD5 | 6d9bb1667c4379ae30f8f72fa6b77404 |
|
BLAKE2b-256 | d6f66466f286561db69b07460e4ae54d7400c5c9db3dc1f46b583a629121c9f4 |
Close
Hashes for ffpyplayer-4.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7ebc55c3583af0990cf83b7fc3aac6c93fa2c2d99d028aeeecfb533678e05b4 |
|
MD5 | 4ae4cdb6ee74e46cdc54d8e6f795a5d6 |
|
BLAKE2b-256 | 4d857eda1f396c14fff2317f1abc19d1bcaf390a2f15776c1502a2290df17628 |
Close
Hashes for ffpyplayer-4.4.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 851d71ca37074ee467bae6ce2a895ba6fa96c841b097b64fe070be60e5682b26 |
|
MD5 | 57018d16da207983eb9a7fb930cb9739 |
|
BLAKE2b-256 | 770f04316dd31201d89dfc9afbb795d41c8a316a67562f723c88eea7f1bf186a |
Close
Hashes for ffpyplayer-4.4.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab900fba55e9f6c1bb83dfd4ac584bfae8e8fef8ef0856af43ac7e0433104d2d |
|
MD5 | 6ab5ebc40b5eba1c00a72bfa674b13f0 |
|
BLAKE2b-256 | f38b04b2cb8c55e922a007b9aa2e2e5c896c93780e2461e39baf29cabf0a7338 |
Close
Hashes for ffpyplayer-4.4.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00eaa961f38f463b7ba48a6ee0a2bd9af8ec26ef1e2164b4a6bf09e02b369313 |
|
MD5 | 6a8880f518b2f03b6fff459aa8509fae |
|
BLAKE2b-256 | 668d2d954b4b7ddb1e36fe7465086535c9e411d2ca302b1bfcd1003d9d27063f |
Close
Hashes for ffpyplayer-4.4.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e8b9a78942623ab52707f0b7dbaf72ab3120fb482bbe3c6346ba006826077b1 |
|
MD5 | cb45dbb1cdc0581f6b80b1b3f0ea6229 |
|
BLAKE2b-256 | b64d9e34cc3c58f8e462d5a66e96e5f61d8dea5363179696d766a677f235ed14 |
Close
Hashes for ffpyplayer-4.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8ef38105d912b8f532dacb9e72673a8dd29c8f045975d8c2b8eccc456844b64 |
|
MD5 | cb83c6841f64dd2a7523baa5c0f32e7b |
|
BLAKE2b-256 | 27a716f93c39a10df07061d0d389d2199181e99fdbf3d0a563a3bc42dc41073b |
Close
Hashes for ffpyplayer-4.4.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e9c9b8cda6f33ff856312bbf64e8102b9b4c3088401ffc23e50e94fec3d11b8 |
|
MD5 | 8bfb60f52f396c754fb5490e8d4f4b62 |
|
BLAKE2b-256 | 9531a3e2ce04fb6f5bb251ede584bd2ed81ac8033dda420ae63c38aabef00178 |
Close
Hashes for ffpyplayer-4.4.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07b05e3fe070dc9174f7d1469311c1bda14050be80c97c3b0ebf63535dda5a78 |
|
MD5 | 1d8c4c0fc7a74e9fecf38ef4b99d202e |
|
BLAKE2b-256 | 597cc4c48eb61d435d65a93d2bea3481319a63c67f8d1eba7296f6000058d9ce |
Close
Hashes for ffpyplayer-4.4.0-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9991084942496694905fa7ebfef4b2bcec9825715bca0f8649dfb580d23a19c8 |
|
MD5 | 4e49aa8878f778250bd46b9442b4174f |
|
BLAKE2b-256 | eb3a95ebeb10a4af4fd9c2ea204aa38ab63d62c17c3d5cfc34accd816f64d858 |
Close
Hashes for ffpyplayer-4.4.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8622bd7c1530ce2432dd64b9a215ff9a8e2262c79b95ab266178d69aefc87cdd |
|
MD5 | 0e687f6066cfbd5b791d8347bd0c0096 |
|
BLAKE2b-256 | 0687e947ca4dc1e3c3baec999b3f0111cb38b0ade83230de145f06e9b160a106 |
Close
Hashes for ffpyplayer-4.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a43b8db1377d8da80859e230dcfc10ede5309692fc1c8a02b4d3db2c399d2dc0 |
|
MD5 | e56560053681bdc6db250c57e327c943 |
|
BLAKE2b-256 | 7bf23ee91b14599050cd20ac3f29446d2b444ceeb2374accf4fae43ce4195ebe |
Close
Hashes for ffpyplayer-4.4.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc769fc9153ebdd6aa0752212f99261a305bcd567851f909b755bec0fdb7023f |
|
MD5 | 14a4f657ab7c9b8b46ec7f7038fe14ab |
|
BLAKE2b-256 | 6705fff82a56a756e9c54f7c91a67eef3b05fb816b31a5c890508ff4b28cd26e |