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.3.5.tar.gz
(88.4 kB
view hashes)
Built Distributions
Close
Hashes for ffpyplayer-4.3.5-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a423652a08909b61d9158f07961d6bee5c4cec5759c306ed1c2227cb743fc851 |
|
MD5 | 8b66135978f053651b28f3f9c620e963 |
|
BLAKE2b-256 | 2f2287a375a3a134d8ae305492669ee5b1e0bbb562dea40d41e21a40c0e043cc |
Close
Hashes for ffpyplayer-4.3.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db49e4012e87613092a04c79f8b3d0ffed59e935ae75df3b6b54ea4f50fb2cf6 |
|
MD5 | 84ec0a806e73e603dd5b9b3bb8e402e1 |
|
BLAKE2b-256 | f1ed167a743a163d9f2a7fdadfb03efbd7e8e1d4c5fe1ecca5d5812ebbe0b799 |
Close
Hashes for ffpyplayer-4.3.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8348e468e20df21f28b0d841d58457de6943ad99048454121fa66fc2fc71672 |
|
MD5 | c95a55296527cc83b43254cdf13feb64 |
|
BLAKE2b-256 | 9c7555b1793fb313ef6ac250d7f7e8c2c192cf1a402e7e3474cf3c5fa6cab415 |
Close
Hashes for ffpyplayer-4.3.5-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8477eb12fd7a8f4b61237e445d1840750a4c3d9f0732f099a7929f4143371d3 |
|
MD5 | 19e5e9834156ff1733513a3347ec063f |
|
BLAKE2b-256 | 4847f9163ff4816e3fec1464b6d6a7c7128d6a811933c6d252f5705fad91b891 |
Close
Hashes for ffpyplayer-4.3.5-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5227ade460772c61a6e8772b2f118b28b20e7e2271ef169d86a779e07fe1aab6 |
|
MD5 | 1af960c7ada6dd5e641de0788d59fa1d |
|
BLAKE2b-256 | a79ca0272400809c721b77883984829f1723cd75125decd54037d81849698fc6 |
Close
Hashes for ffpyplayer-4.3.5-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6e51bdc63ec251cd46d57282f77d8c5599f5359165b6e8d68d06237a7d1e806 |
|
MD5 | aa8cfff85f7f076417b1ae5588bff0d5 |
|
BLAKE2b-256 | df44c322fee13022042a53cc6d06c58bfa6b16ac1f4960f79c5372716021c376 |
Close
Hashes for ffpyplayer-4.3.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd1f008c7fb1f7ad4886bdd4f89b301494e8202f4cdb0e47a94b0246f0e0e9d7 |
|
MD5 | a4a8e0e532a1fae14cfaf686452e8180 |
|
BLAKE2b-256 | c84064e352270d5321dbda50aea22f6acf570027be0e978aa659ff0bc32e3364 |
Close
Hashes for ffpyplayer-4.3.5-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57c46d8e932868e2f97591be0f141803beafc524dee4218fd18488e0f1f9b7d4 |
|
MD5 | 7d3611ab772bf6428720d9b1c03f1b51 |
|
BLAKE2b-256 | aeffae931f7de388669d3f973a952bafff53c2274da63ad7b6d53666eafb0bdc |
Close
Hashes for ffpyplayer-4.3.5-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc35177f14d88d6f6b523e2ac38a5da81c5529f2d3a3de4b2ed285e390da6bbf |
|
MD5 | 4e4d7f3adf4fcc8ba991d7694b2558dc |
|
BLAKE2b-256 | 4a1a3a0184de4e638dbe59f361bd68ac2f54a7a10d33ca2dd6c139a9eeba567a |
Close
Hashes for ffpyplayer-4.3.5-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24639be303e92863a3d986a5c7d114602a33bdab48391aa6a4e09a8b08a54db6 |
|
MD5 | 5dc9fb49d26156bb34da6858969880ba |
|
BLAKE2b-256 | a2f0583b70a83cd546f22825048c5b1ba8dc1b329c78cdb98dc24bad57f35ca4 |
Close
Hashes for ffpyplayer-4.3.5-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a57bb1dd3eee3ae7915b186a71b7448f3adce24d1a486017eed5ab60c7d72821 |
|
MD5 | ecfc0db95ecfba394ec3a0b1e0185d4c |
|
BLAKE2b-256 | 1671207cbf0486e853ef888e4c0e189851ecd3acf65f2f15de49a3f96ddb7644 |
Close
Hashes for ffpyplayer-4.3.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63c2da0639be85b91f6b0ca2a5f95a5035db231c0b94901000b6e234487f534a |
|
MD5 | a37d1fac3becf61cf38edaec4ee8c438 |
|
BLAKE2b-256 | 335386c30b32f8f75b91e7660c265b60921b8fbfeedd9a9cff62a09dec9177f0 |
Close
Hashes for ffpyplayer-4.3.5-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 207c00dce7c299e654b696a35bc8304efc52d72f1bd0de11beccbbac6a8a01f1 |
|
MD5 | 2f5cf7fb0fd2b358dc4cc98abfc679ec |
|
BLAKE2b-256 | c14f24f355da25e5a00b0af85d959afcb03eb6641089086e5a7ed35d11b25ff2 |
Close
Hashes for ffpyplayer-4.3.5-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 091fe97a5b82db0596780069ba273b53ece5971a43b8ae71956e671681bad90d |
|
MD5 | 82aacc0120672ca290b1a8a946166a72 |
|
BLAKE2b-256 | 2086e3a883afc23064d1376d1a487142de8fa27b514aedb7e1a10686e942005e |
Close
Hashes for ffpyplayer-4.3.5-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 599b2aa14e5c57fac8a51a918e010a758ffcd58261abc981153e1f63082e69ca |
|
MD5 | 2b20054b6bef82cdd9a26f735d437561 |
|
BLAKE2b-256 | 3b8ec3a2582e106923e0c52213094df7ba2b77f282e80b9f13cb7bbb88f4c011 |
Close
Hashes for ffpyplayer-4.3.5-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 034ea7a08b76cc5fcfc6dee52cc3bd26843efd63b13d312c80396a9be0e2620f |
|
MD5 | 69eb681ae86513da55d7c8b4e0c77bcc |
|
BLAKE2b-256 | 40df30017266de365ea6ff30df583c075deb4e69feb03c40c149b888510fa068 |
Close
Hashes for ffpyplayer-4.3.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efa28c0905556cd6d4fdac78c99664c4ce47d20a1b225d70e1a8cfee07897695 |
|
MD5 | 07ded1fe84ee2976df9dd541c099e00d |
|
BLAKE2b-256 | dc38e1312f96fb56aaa1c2af37d3917e5e4ccf251beb4a79e093f4ff36ab1ec7 |
Close
Hashes for ffpyplayer-4.3.5-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92246322b48697b7f26c86e5fbb0ce97e7dce4bb9eafbd3ba5348c18dfc0b7e3 |
|
MD5 | 2b21e444a7fd8aba3271ceb07f1aceb3 |
|
BLAKE2b-256 | a56592afc688b05f6c9f0d83da0e99acd5fb287dc277b1eb25d29cb7e7c70216 |