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.3.tar.gz
(88.6 kB
view hashes)
Built Distributions
Close
Hashes for ffpyplayer-4.3.3-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 293249ae4cd2498df3576c27f8b71a48ca766c55c1b07edbacc57550f07329c2 |
|
MD5 | af2a8a667acfc63f83d35354ee6c6425 |
|
BLAKE2b-256 | 852cd977dcba82dd4a5ca5c5024c2e4ee407169c47960f95a83175a8433fadff |
Close
Hashes for ffpyplayer-4.3.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c901a15bd9794faba43438dd88ce002abed2c5940fa55ab161e7c6e5aa5645f5 |
|
MD5 | 5b87e8970ab990670bbe87ac2a1f909d |
|
BLAKE2b-256 | 872656506aaf37454c29fee5dc4429d8d00d0039d73d75f0467e64f4f7ee15d7 |
Close
Hashes for ffpyplayer-4.3.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2116c4932934c3117eef347c0bdbb3e97e97cc2aaafbad81681687189a9e3b9 |
|
MD5 | 67577f848962557bfd3b4d9bc32e9985 |
|
BLAKE2b-256 | 2a2946e02bc9db51f8c4205947beff5b9b869457d750e5141f6356e75aa72ad3 |
Close
Hashes for ffpyplayer-4.3.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 482fd2f954f17ef06be8b2bed2d41581aca60da76ad4d850fd96311e6995e3f6 |
|
MD5 | 22415ae7ca9a0c23eb2578b09fc5137c |
|
BLAKE2b-256 | 5f5531e5947121e9a7b4e7a077ded7f54485c773bd550c1843bb9a7c38d65a64 |
Close
Hashes for ffpyplayer-4.3.3-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 775f790021dddf5ece1e65d9675a3474cbbd904b57d70c42419e55962fce9a06 |
|
MD5 | fad8d670e971ee3763b14a9389e3395f |
|
BLAKE2b-256 | 3ce74a9721298b1fcce3cb5493e8d490e71cedddf55acd205d0c2153160f734c |
Close
Hashes for ffpyplayer-4.3.3-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fb53402dbabca4c550d1f4368ff878f05af0d44f92b7887c8332bcaebab03ec |
|
MD5 | 4a56e60a99401001b4aadb384bbbd3b7 |
|
BLAKE2b-256 | 0df8b595e79a53bc9d25f504f1dca5a11e862c7aac784cd2c883e8730225b479 |
Close
Hashes for ffpyplayer-4.3.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33b9c092eb0b807821f7b5890f8ef3fd7d6f5a03586e4a923e6ac36b9659d14d |
|
MD5 | 99fef0aba98478d9732d21542203a599 |
|
BLAKE2b-256 | 1ed556757902930d025936ab64e9ac7081bd4bea365f7616de525a36cf924be8 |
Close
Hashes for ffpyplayer-4.3.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ced1592e44d6d9c5fe81157e3618c421a8585ca94e4b3cd49cd4bf453c54e33f |
|
MD5 | df344ce13204cde90663836a6249dcdc |
|
BLAKE2b-256 | c79d7cd9e2e56930e9ceb3485e09094bf02cbf477e9d16e7ac3804a4d7a75442 |
Close
Hashes for ffpyplayer-4.3.3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1234f059c55390c4de9419ea382900b50c1f1703adc8d305e56f15547107029e |
|
MD5 | 39eb26413efffc6ce351bfa977681dc1 |
|
BLAKE2b-256 | 337cc354901b9a3b393c8e9a6ef95ae8414453f4054b7453780255c7af2c1957 |
Close
Hashes for ffpyplayer-4.3.3-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73eb421ec606287401e0e6797d813b8e1431d56c51a51da77316efa348462088 |
|
MD5 | 5b62edffa35facdd963b9b050b3cd592 |
|
BLAKE2b-256 | e9dd5fefc5b9ce1a952ff122e868e8b8ba52e207dd170dd368302f03d709eb50 |
Close
Hashes for ffpyplayer-4.3.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7339c9dce4170ebeea5519f7fa126a186200038eb98a05c8473e8d9ab6db43eb |
|
MD5 | 552b278309a0c53c4f474b21e970eec6 |
|
BLAKE2b-256 | b6d54e9bb4033db02a8297a6c4027aaca34b9287fe9dc951da863d7edc93a408 |
Close
Hashes for ffpyplayer-4.3.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76ce9a2dab58df01b52e1303db1c8d87432a7ab212fe124a65424e09762c51a2 |
|
MD5 | 61560c56a634a6e50f45950dbf12fb44 |
|
BLAKE2b-256 | bbbfff948a4a624aec5f1c3e783fa438f6808e9db95670b09a6ffeb429e757d3 |
Close
Hashes for ffpyplayer-4.3.3-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 404ecb1c02c2244beeb0aeeb6710c44361db39f20a5feea849e4e59cf8f7615d |
|
MD5 | 35381a31fc457151d648baac796a8548 |
|
BLAKE2b-256 | 2391c9a35eec3cbf5c5b477579352328d4c07072bef901608ac4b9655c9efd6a |
Close
Hashes for ffpyplayer-4.3.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f3ba01cdcdcde3b0f0f9d4c276e216a545c789f9eec37c52f1e8d27cacb4172 |
|
MD5 | ced3d5a6c20a3b8c40fff5209252b5f6 |
|
BLAKE2b-256 | 9d8579b2d50882cc5b89bfcdd84b519e9348b27c0ed41f05a5d78700e2ba6d97 |
Close
Hashes for ffpyplayer-4.3.3-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 968bdf24402a72ab4eab122838b3537b4f44a27a8fdf4e56b6b330e41a83ac90 |
|
MD5 | 3cc76413e3b2d7a37be7302f96554ea1 |
|
BLAKE2b-256 | 4813c3dad4ec775fc989afcfd83125ebd674e29ca97193ed5cb9a9777a9959b9 |
Close
Hashes for ffpyplayer-4.3.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0945c2901de78d1122765d4db5854af4fc2b3ad9151a6806d8a8073300ff07e5 |
|
MD5 | 07be1513e271dbf2666033500ebac0a0 |
|
BLAKE2b-256 | 7e508520744883debcba0d2930f61e62ddc2fb07e499de63822a67ed507d45ab |
Close
Hashes for ffpyplayer-4.3.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1af8cc2f11efd30e2923d2d130fd1b7b158e86c97a3a5eeacc12c497a1f025e1 |
|
MD5 | 4700fc565a9331d5cd733ae10472976b |
|
BLAKE2b-256 | 17ee2cd83dbc564e6f68f9c4801d603407c7ab38010203cd627a050026043112 |
Close
Hashes for ffpyplayer-4.3.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e41a08ba717016e25e28150324ec058bd81a49c46a501b64d95df27c99b8960c |
|
MD5 | 55fc8207ff22bfa27b6647ae2c144065 |
|
BLAKE2b-256 | e1d6fb915e1673c560fa0d9dfcb8e473427206ca81dbbebbe4f8f039ccfa4eb6 |