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.2.tar.gz
(86.2 kB
view hashes)
Built Distributions
Close
Hashes for ffpyplayer-4.3.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97a684f7549c0564e7c172a145fa2d6c25e0b9790b1fff6a5dfc89ac8c167949 |
|
MD5 | 3d418fc403e558028a5bfc83edf0dc14 |
|
BLAKE2b-256 | 0b2cea56d8c7759549ac107b0a33b8f93e3ee943c587c23d00ba34d05ea4f66c |
Close
Hashes for ffpyplayer-4.3.2-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a08dbd48eb108396e8957713d08123133a0a447aa505a1f92d351076c7c090bb |
|
MD5 | 799dcae383a2ec0cc8d561d5333b0446 |
|
BLAKE2b-256 | 38d78262b879027dc26880371b16840715d713296845c15cb505cd1823c5b94d |
Close
Hashes for ffpyplayer-4.3.2-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66e8b6dd86ba45ce999e8d0e95596cffdd64aed3bb472b8da8eb66419c7c68f6 |
|
MD5 | ad48b3069cf8a948de71bd501c011c6c |
|
BLAKE2b-256 | d61831659360cd1bb2bb1c6bbf2f19bde02be40df5c4c71f1a28fa5eba30c668 |
Close
Hashes for ffpyplayer-4.3.2-cp39-cp39-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5775886c6aad0ce49b73f0d53cc1bec585f5cdbea54a1a3266f6a4686d297c9 |
|
MD5 | e5ebe114122162316b1a31f884c47f4f |
|
BLAKE2b-256 | fb0f444815d4aebc8c9a4a4e11298bab6a86c0d91ba29d83e853224fd61d5c66 |
Close
Hashes for ffpyplayer-4.3.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92bbcc7f125e64e3efa46deee744d6cf25fd088aa578364a61df0ae8a24d3206 |
|
MD5 | c76f7690ef5f2b7ff16b71259c109056 |
|
BLAKE2b-256 | e5e0d1b19e6ef48167f788493d474a0ee1210ad5e3089895ebce521767f51fa9 |
Close
Hashes for ffpyplayer-4.3.2-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d88560dd585dd953bdb9b6d924a9706c4d3acbc16a6638c3c24e9d86ca5ac760 |
|
MD5 | fbd2be341f0375c301a12ca546bdce84 |
|
BLAKE2b-256 | 9144d10e1182792d559c622189acf4e7c7d33d3e085e0a0ab4f2e927774e7705 |
Close
Hashes for ffpyplayer-4.3.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05ca4f8c4200419f0bd8a80a5d654190d570e4b46b7d17239540c15205c5a515 |
|
MD5 | e4bcb8ac37fcc4650c43843e48a0aba4 |
|
BLAKE2b-256 | b74bf83b372e5d813138dc13955fa64f8f701c61dc52b0e57c44150f1a640fa5 |
Close
Hashes for ffpyplayer-4.3.2-cp38-cp38-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf70c976fabfeaaad9ec9b9eb501ac1a1d92caa3f436b83537c77f38d4afc5b2 |
|
MD5 | a986393531e9588d5a4c9979d7891cd0 |
|
BLAKE2b-256 | b96b2257b77b91299abc7938c56566885afdfdaecc41a9bcacb93c32f27fbe33 |
Close
Hashes for ffpyplayer-4.3.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b4e8795af354594e1f693bab27346d4b3ef3cf77637826cca7d38dbbcc19a6d |
|
MD5 | 12cbbe4efcbca1173f10fab31c8fc8ba |
|
BLAKE2b-256 | 12b525ee6b2039357274a726de503fec6347fb0af6bca3ed9ade3a2bd3e15f49 |
Close
Hashes for ffpyplayer-4.3.2-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e9a268f160980fa442e464527f9c42b4d63a632af4633a25b33df35395ffd4e |
|
MD5 | a23b21a61521f3bc933f6feaaa8abca8 |
|
BLAKE2b-256 | c2c1309244a61a7beb05931bd8ca63973e0c2e5e8b5e5e1487a67a3b59a96b4a |
Close
Hashes for ffpyplayer-4.3.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad4f1b8728b0333f6ef2a77812c986a8a11b7aff9b8b8babe31a8d3c2a374273 |
|
MD5 | 2dad9908bd03e0945c66dc9c930379f1 |
|
BLAKE2b-256 | 9216ba3ff80ad8913e2e3c5f6d226f40099940ff14d2b26b335a857a4116fb29 |
Close
Hashes for ffpyplayer-4.3.2-cp37-cp37m-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88740ccaa68c2832f1d4c57ff981c03b74c78b19d2bc75d2cbdbf2a6a76ff01a |
|
MD5 | 10ae60b7b0857edffc7384058a4810ea |
|
BLAKE2b-256 | d23b458a767f58c372affa3022687adb651aa2e1783961d5c83906585d887f43 |
Close
Hashes for ffpyplayer-4.3.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ca05152f6420d494f5fedda4f5b48d096bf4c3c6370abd9e739113504916238 |
|
MD5 | 5422b9ebb8e5fbd43be3bc297bceb14a |
|
BLAKE2b-256 | ed5854aaffa84e75af6bc96e57d051fc59ec2d246e4a9da6a7c43a0f01f91bc4 |
Close
Hashes for ffpyplayer-4.3.2-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27535efc6c2fab2574ae283a025809fb830d4ebd04aa1ef5d2928e4739d4c0fa |
|
MD5 | 416932ade2561e222013742bbb514614 |
|
BLAKE2b-256 | b36b72a64c40b530536c4aef137dfe910646c47581a0fe0917bb600a7d033f98 |
Close
Hashes for ffpyplayer-4.3.2-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e676b7d8faf2fe7e62faf3a8a3b2cd8dbf0e4bdaeb170fb5401e6b72e1e6c7db |
|
MD5 | d285e758a257c8efe466727828b502d6 |
|
BLAKE2b-256 | 03f7ca15417053f95760f100b5fcbc23a4aa930c7aad16ccb346edeaca2b2241 |
Close
Hashes for ffpyplayer-4.3.2-cp36-cp36m-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c487b33245ce5920c4661f9545000f1ec1534517f55bf4d0f3186a7348cc6b61 |
|
MD5 | ed54e96d64a31cc1a53e9a672a259024 |
|
BLAKE2b-256 | 47fc78ce1ac5f54ca921eb79cf3d59af290c7dd59eb89df20d8043e14424e1b3 |
Close
Hashes for ffpyplayer-4.3.2-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f54bf7dc120834cbc265ec09ef8c71d29d9ea1660ab11ec55ccc316f9969677 |
|
MD5 | 345c968de3361328c0294af100acaa5d |
|
BLAKE2b-256 | 6072482e715f0c8490bc32d85ff5d16f192e1ae8853d305513aba5332fc190ec |