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.5.0.tar.gz
(88.9 kB
view hashes)
Built Distributions
Close
Hashes for ffpyplayer-4.5.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed16e435a3743148c9a309ff31ad9c96023f7c6cf170b50be3708f64f1da1d6e |
|
MD5 | 500bc8989b527ff864c8b515eae7341a |
|
BLAKE2b-256 | 5bb14974fcd0ef4ed3a00202af90658a37e4d08ef08aa2d11ccfdfbce9ce6556 |
Close
Hashes for ffpyplayer-4.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64f11d053be9c569b4b4c6eaa3af571845dddceb1579fe6dd2509f4d38a2ed90 |
|
MD5 | cf52188e5857ef239a31151f1fb95079 |
|
BLAKE2b-256 | 2f75b9e3eeefd2f0d1d0cdb64f607d1e077cd6cd7b78488f2551392c256a3e0a |
Close
Hashes for ffpyplayer-4.5.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3061f60a9ce1837044fb3f446dc5deee76cf0d37efa31b3254bb994629c2b356 |
|
MD5 | a8d6d2235f732a629598fdcd65c18dd5 |
|
BLAKE2b-256 | 1266f1729370436bd4ed898fbb6b0cc76aa3de002d15b89b3fcc2f1e4bb904dd |
Close
Hashes for ffpyplayer-4.5.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5b88d64fcb572bbd4ae5ed7b8f58d76ded1224f93cb8d4bf10fec46cc2e8d76 |
|
MD5 | 736ae372f1cb33abed0f395c3a3bc248 |
|
BLAKE2b-256 | 5ca9fca528e3fb02d382b8e48cb32d8c57de2f459674b71dc90a8f750241acef |
Close
Hashes for ffpyplayer-4.5.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86d45d13293dba99e34f45f0193643ae2883739b959d2b9b32ca4bee1ea64639 |
|
MD5 | 0291ee1e7600466f84d017e3729cb8ac |
|
BLAKE2b-256 | 706609f011217f68cab94b43d78e0c8548705bbcd5a6ae236ec9fb5329941fc8 |
Close
Hashes for ffpyplayer-4.5.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 807314cc92af39a110411cc745ff6ae04583b33fa0f388d99ac0f912202856a3 |
|
MD5 | 5d646e5afd557c256829f37819c43796 |
|
BLAKE2b-256 | 7da2b4f3468735417f6d8183406bab45a2d81f99d6e70614d0bbd631a06d9e3a |
Close
Hashes for ffpyplayer-4.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7da5bf16a70a659c1a801fc1dff18387e327fce187a7d9259ff1f72f2cf4d87 |
|
MD5 | 1be7597780af550cc16ff5e6a49b185c |
|
BLAKE2b-256 | 53f28590e76c3f59b9ada898e93228c3f3b81973482b1290e7e2ddc72ab760ba |
Close
Hashes for ffpyplayer-4.5.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29580a81541bc7e5871a88113bacd76695f719b708f6830e0bea7292401bd259 |
|
MD5 | 4ca88dee75c3874290cd7608fda400db |
|
BLAKE2b-256 | 1bb48489a4856f35d3e78238715ff3bb3999ae6e0a25f805c3d20188b055f9e7 |
Close
Hashes for ffpyplayer-4.5.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b2239ea6d69fbec7e7733834632e9c3c47dc76a9db77e1b2d4b4174c5279bb8 |
|
MD5 | 706c2f3b49939a5aa27b0d05400a9a67 |
|
BLAKE2b-256 | 48d2771fe859244d35e6c6af96ddd9a0e1084e2717179c1e4d54b418f6b79234 |
Close
Hashes for ffpyplayer-4.5.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15b92ebda56d88e2ba2bbf9ba3388f043b0cd25a3c45cffc105399b539fe63aa |
|
MD5 | 037cf94bf27284fd68cf4dd5908a933f |
|
BLAKE2b-256 | e081c9abfe6237c140e675dae82fdbea1e5f11016cf29c24f88aeb3efd6434b8 |
Close
Hashes for ffpyplayer-4.5.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9715a683d9c8311b42ea63ff9dabfb538ffa9e984dc0b69f99deb25603ab8e83 |
|
MD5 | 746115b45538732f54c21209dadf6d0b |
|
BLAKE2b-256 | 481fa1531b1ed0c1013cf219983382e1488db755ac236955b4032afff87a8291 |
Close
Hashes for ffpyplayer-4.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcce3ca0b0360503b9671a5b628c7a9718e647f2cd4dd2ed9d124aafb3a49a8c |
|
MD5 | d0e7cb302953aa0cc6f8c189923e3741 |
|
BLAKE2b-256 | 77b4eb645364487edac350920b97df155147ed31cba2b5ce07a98cf93dcf6169 |
Close
Hashes for ffpyplayer-4.5.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60e234bdb51def03df4d12fc241398ab4ea6703eb351b44526ff0a3883bc8eb8 |
|
MD5 | 696792e893c87e2ffffcb0a906882259 |
|
BLAKE2b-256 | d043b28431610c33e58dfaa528b6c6d3ab8d32d45615211d388cc8a191ac47b6 |
Close
Hashes for ffpyplayer-4.5.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e1a12cd4736bb1e88acec9c821c0b9911e37a3b328da4773f088713362b23b3 |
|
MD5 | 6273b88cb58c91e965ab4b33662f57f5 |
|
BLAKE2b-256 | 5d6b8dafde9ee9cf84882d5a9108737673cb0cd0b8816ce4d1d4f757b65f0aab |
Close
Hashes for ffpyplayer-4.5.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4beea77b6bd0442f17152db3f895cc382720550e829bcf7373136f8d7f66ecf |
|
MD5 | 6d27642bc013cd5348ac4599ae761798 |
|
BLAKE2b-256 | a1ba7727bb340e7f0b09239f68666c832519f8a2e0295c39d8ab35b1537f547f |
Close
Hashes for ffpyplayer-4.5.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f51b533c60471ee9c1d7277bbc8714431cba66c972eb743e570aa24f67fa4a03 |
|
MD5 | 2c8012efbb6cd1e6c798f98dace5a7f3 |
|
BLAKE2b-256 | 08a3e421789fdc45f07ff2aff38e53d3f77cb474f243fe7d399327fac6933112 |
Close
Hashes for ffpyplayer-4.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7294be72af4b1c4a2262d1a851006a2233888958be4c04afb114a9ec8b478d34 |
|
MD5 | baf332769c8e9de5a9b02a33cf4ae5f0 |
|
BLAKE2b-256 | 9ac8a552ba7111994add897f74807f5234e675dd49e6ca6f8223e1fcc932f562 |
Close
Hashes for ffpyplayer-4.5.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 429a403b8ea365a29bfb89fa31c230d675094dfadb3423cc12a2cb2ef46c583b |
|
MD5 | cd47406465389e91347eae18c2d0268e |
|
BLAKE2b-256 | 534b66fe5a991eaa0e64348fd53dbd2962f263643fc940c7d23c2a7dbc30860d |
Close
Hashes for ffpyplayer-4.5.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d9fb5b44ccb9e1577c8f8ad6c242d6b48e04013c2ab8759a4f1227d7dd9d676 |
|
MD5 | f227ff1a4d3d2bad11d78d9ee81339f2 |
|
BLAKE2b-256 | aa63736b52be660ad088d3a372f44729197c3b00a1306ff4b82feb81f12e8ca6 |
Close
Hashes for ffpyplayer-4.5.0-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c18c087e32cfb50683d22495d13a96858b6834d39fd229900e13e7fa31d4e05 |
|
MD5 | bdc4139c03e705ffb0aa5b5c7ecea604 |
|
BLAKE2b-256 | b0c2b42de0f14d61ed15b4542adc1385f4434b1e3d9d81f89f843e64570d75e7 |
Close
Hashes for ffpyplayer-4.5.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 339dcdfd1382a7b3180e23116fa208d7f45eec971677f4f298e9eee6be6eda95 |
|
MD5 | 0aa63bea8b688ae82e889a53acb015c5 |
|
BLAKE2b-256 | e962dc0710809e315b9b62b22c9fc3ca37982413d3b1ee126bf1d7750dbb8113 |
Close
Hashes for ffpyplayer-4.5.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce81d7a7ba28de5f986abdae093b5a2381a33d0e16976fbe27e3c508e38898df |
|
MD5 | 8416c336ef72da48f4444e4fbc974f87 |
|
BLAKE2b-256 | 4e69750125a73a7d047ed6eb9de56fd8435bd500958b78887e7cf5444cf5aa84 |
Close
Hashes for ffpyplayer-4.5.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d958eec584fdfa26950c8387372678e46b34696a533ac4f41de9cf52497676e2 |
|
MD5 | e55fac37155c295ef3035237143a2879 |
|
BLAKE2b-256 | 4d2b8a980ed05c28bc03b22c7dde479c1c69d6b2608185915b3f327a6c6be166 |