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.0.1.tar.gz
(711.3 kB
view hashes)
Built Distributions
Close
Hashes for ffpyplayer-4.0.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b60bd6848836ec4bc00569ea514d5c7f7c1bf031996057afc6340755b8b5c0ac |
|
MD5 | c23ad3159168faa815d040a23272ada7 |
|
BLAKE2b-256 | 7d6cd8e017c25ca6d5325af37638fb2ae7cea6868f241dc67f3597ba4df6e7fb |
Close
Hashes for ffpyplayer-4.0.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b95bea38d9c082b94e8d41072cf0050f5b5d220848c30bba4f80b75fc4280048 |
|
MD5 | 0550246cc2d54706266932fa0989971b |
|
BLAKE2b-256 | 792516aa9e1e5fa27c2cacc50a48f77b317d36f4d16c4582d97cf76b94275597 |
Close
Hashes for ffpyplayer-4.0.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c361caee8c083da0802f73cfd254b1b0e808f84515028c5e3616dac36ab1c3bc |
|
MD5 | 1dda17a67b94345586b7d1625223597f |
|
BLAKE2b-256 | c7a0cb3187fd40579e7e3e9a54fecebe12325622eef4d945c2037b78bdfb4aca |
Close
Hashes for ffpyplayer-4.0.1-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fb95c509dbcdf0cb95bc96cd44cd153268d38cdf4e1b8a0fbdfe853e2d3ec28 |
|
MD5 | 57d32f7f8ad7dbd0031cd4fbbb6a3070 |
|
BLAKE2b-256 | 1977b85043cfc872c13c77d224df16709c399149ce4491151709267158f1ed10 |
Close
Hashes for ffpyplayer-4.0.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3331ad6f895f32e3206456a0ccaf7cfd8c07c95c883290bc73dea15baba1c675 |
|
MD5 | 7e885ca830598f7a01d30814130602fa |
|
BLAKE2b-256 | e176276d104c85e842c54e8de2b9661e51a0d492352d96a33b1b0ac59651712a |
Close
Hashes for ffpyplayer-4.0.1-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38ccde4151c1dcef74cd99fb66ade999b23b34141dd53051092ad95e0dc65d56 |
|
MD5 | 8634ebf4d72ad7352facf4457f3c30fc |
|
BLAKE2b-256 | ace48ac4474bc43fa2f0dc5d63d5b3330b0524e289ce48bca9086f02ee04cd31 |
Close
Hashes for ffpyplayer-4.0.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59166095537359b45e035e8d05af5027df8ec40cf9146986f84a9b0aeccd5647 |
|
MD5 | b25a63bb3e4dcf45df8c71cc3b8a1728 |
|
BLAKE2b-256 | 047d524376a24e20aed033f63e34a8292c94297dc9b9706a1b1271ba32c46538 |
Close
Hashes for ffpyplayer-4.0.1-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d8df8d4c2f4c4f22925c6940497af1f48d9a233fae69acc75d0263a88478e82 |
|
MD5 | a6ebcce7463c1ec6c44682307a77c84e |
|
BLAKE2b-256 | 93b4a0e1a4e2ee148d4c90d966b2775b46ecf23a3c1e63e64e95470485339db8 |
Close
Hashes for ffpyplayer-4.0.1-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c2992a81c3ef9d41b645c8f4285740c9c6d7867a8314784e6e63522965c29e8 |
|
MD5 | 84d8d9a9c1626f9bec03c92611e23593 |
|
BLAKE2b-256 | 7edfa21f027f2ebb1af0135a877fa76135ca0fe5eb9ecad535b58a0c4266cfed |
Close
Hashes for ffpyplayer-4.0.1-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db566c4ef4d892918c0cdee720144c8f30c9959455541e84b9fbbea2aa2a9acf |
|
MD5 | d75a94aa508870471a44049707c112d2 |
|
BLAKE2b-256 | 3079164103e04b93e9581d7eb32d783e8da888417d65d9699204790588321528 |
Close
Hashes for ffpyplayer-4.0.1-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5edd6d890e635a583eb2151c75902737d5ee0f406f8eb3b42db5fa8d0ceb9ca6 |
|
MD5 | e57f6e8560c74d5e76192a4b40c17618 |
|
BLAKE2b-256 | e52349718f8bc9ab79f71a23b6a1cfcf6b6425b04b9757c950c5069fbdcb4f1a |
Close
Hashes for ffpyplayer-4.0.1-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae07cd556e0c12faf38fb6c571385b84e0ec64c899008a7ae86c532503884348 |
|
MD5 | 1670dd6a9485c29c37ab764c931c3000 |
|
BLAKE2b-256 | 97a3d965228857eb635cc9142454bfeb07e55e5c4fdca216d90ae13f9fa415bc |
Close
Hashes for ffpyplayer-4.0.1-cp33-cp33m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 225939dbfd74efacaba37a03c880b0938374f09c27e3f0db1f0ebc0d742ad849 |
|
MD5 | 44c63f2acf91fe8fdd0503ba24b1c760 |
|
BLAKE2b-256 | 0b405794e8c00f54f1ebfe6bc25cedd90c5dc0044218df7fc373d775cc0c04a4 |
Close
Hashes for ffpyplayer-4.0.1-cp33-cp33m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2036f6f76b937812a7777ffdfbf5331d7db44b3a68037c156c3c4ce92f9b43b6 |
|
MD5 | 8d43a47f01007f16987c18e3cee7e8cc |
|
BLAKE2b-256 | 7133a386696c0c012d256047b98e43d0a6c05045f41556b964984ae855af284f |
Close
Hashes for ffpyplayer-4.0.1-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | beefc5f341f4a424d1b73e117e7b1c03f416ffca715dd020daf5544d13bcc538 |
|
MD5 | c3e4ece756ae036383cf8fd981984410 |
|
BLAKE2b-256 | e91ac1db497819b04e88e00b03842576033f01daa625a7e1144db294ed0f734d |
Close
Hashes for ffpyplayer-4.0.1-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ced89fbb21c83009b2b8252442a8d11537be0eacc3babb9a8479b6c4b7a9b12 |
|
MD5 | 2ca323c7dd042d8700a9a789ac0d1d9b |
|
BLAKE2b-256 | 61f29822c556940059ec20fc3c9b4f967b5eb3ebb603fc651919b5cfe1747b96 |
Close
Hashes for ffpyplayer-4.0.1-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3687576bc9bfc35d281ad26a4a95ea7a143ef55e806b937cbc5a15498eb61198 |
|
MD5 | 3f7b824ae82edef5157e0c4e58a1c25b |
|
BLAKE2b-256 | 2c1aeaa05a419ec8291e8ac7c188351727b25b4fcfcce37e759420e96b5c719c |
Close
Hashes for ffpyplayer-4.0.1-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d630148de6f777010ed2f9b9e38c3a63fa893e1d0c3ba85e772192b5c218fa8d |
|
MD5 | 6257ddcaec5dc33d57cc968e62fa5051 |
|
BLAKE2b-256 | c4f6fe51ca05caed5c880531f6ab3b1210e5b829cf48704808c1b8a3ccbac183 |
Close
Hashes for ffpyplayer-4.0.1-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d002e6a8753da4535d694c310fb857b294ec99cc43255c992e8c87690b4e82c |
|
MD5 | 002ecfbd2a74b7ec998591d572254d0f |
|
BLAKE2b-256 | 37382df9ca65b6192e29f8e058c6d613331d6fc40632586825dfa3d921610787 |
Close
Hashes for ffpyplayer-4.0.1-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff219107f0975fcee31246a304e8d52998710a538061bdbbbab940ae060c1c87 |
|
MD5 | afc4eb2d403d3a70c7a002668fe88c7a |
|
BLAKE2b-256 | 8817c2407b2c377db669d5eced381fe7f9d5a8d56ad34d542f01956b250a426e |