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.3.1.tar.gz
(84.6 kB
view hashes)
Built Distributions
Close
Hashes for ffpyplayer-4.3.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4038e5adaac6bf0a902bcd6abdb27cbc4350b0405c238c31460825145bba840e |
|
MD5 | 5b49316fc392c62e9e2bd5f3f143cad0 |
|
BLAKE2b-256 | 6017b1452d6e4a0600f854e2a0ac1f094ed3e96abcd84e7591892e7bba3827db |
Close
Hashes for ffpyplayer-4.3.1-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08c516f62cce0da010a45c32d1ce3c5816500d91b083a77c08e7eadddfe4f25a |
|
MD5 | dc50bb9a253a1744e96fa27f9228cbe8 |
|
BLAKE2b-256 | 59cbadc8605c3d06268e4eba837773600cf785ef06909a396c2507987fdcdca7 |
Close
Hashes for ffpyplayer-4.3.1-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d63ca5174722155d2bad273351262d0a894c2a67c9945ac93e974fb9fbf63392 |
|
MD5 | 1c894328ff9b2d6f277e80b543718ed6 |
|
BLAKE2b-256 | 709bfe3bb1a40cc571b20a39c524e248a80081f1df99b9080642870d7e2dbcbf |
Close
Hashes for ffpyplayer-4.3.1-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 | db21a1bd0f384ae544d2f12f16521c0fea5c355e965c703aed23a58fd225c9cf |
|
MD5 | eaec7d57a8d50b82bdd77690184a65cb |
|
BLAKE2b-256 | 77660f3ea0bf55375fc633cec05136fb63c1962b878e72ad164ce447d3581cf5 |
Close
Hashes for ffpyplayer-4.3.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 206c45660a553263d51f8a6abe679ba2966cee4979fdfc25e7385812f3e990fa |
|
MD5 | 5d148049256e3e860fb4707e0ca1de4e |
|
BLAKE2b-256 | 650ca71ea9a8ee7bf3b063518c59d73f6a3954f1b6fe9c4f554c6620a22a5963 |
Close
Hashes for ffpyplayer-4.3.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3ba52c29cd5278dc2268fb67300fee830f5ceee02940b92e7a3e6a4cb350131 |
|
MD5 | a5e932c710359f32c4fdf3221d08ee43 |
|
BLAKE2b-256 | b76ff838b43b1091a4092306bff1eaae640d17962e2bc2488241433287238cbf |
Close
Hashes for ffpyplayer-4.3.1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57ce03db15c5bda150340f1f5df59b3b2a7ab92c11fc50252d9b0ba35010bdc4 |
|
MD5 | 0b0f480988d31dabd5412adf291c89ea |
|
BLAKE2b-256 | a938d7cece532273a2ec8f2d27ba2769e466a7a074b40658cef7a00c8b10a67a |
Close
Hashes for ffpyplayer-4.3.1-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 | 73081d8646de3281d44b4c1a2d627b9a4e3e0237530e5d77f5dcc85b47286c4d |
|
MD5 | 79251c47a02ad0e2e653dfdd154ab810 |
|
BLAKE2b-256 | 5a3bdc3bb1ce426a1acc1ae4b1f4b9a1896fca13715b41ef211ac5e25b957174 |
Close
Hashes for ffpyplayer-4.3.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcfce97f57793005b8b15799de96db205780d90856c6ae2c6aba3a89b2591c9a |
|
MD5 | f3a86a4ff4469a76fc9ab415bd192059 |
|
BLAKE2b-256 | abc745bb4da1c9cdb70adaad47229df78ef66ea9467ce90506465e28871d362f |
Close
Hashes for ffpyplayer-4.3.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72ea1b0f31ebdeaeaebbcc56e52e8fd16a6d4facdacadf8c9b30ca56b2b9abcb |
|
MD5 | c2b95d819c40d18cc9d179cfad187082 |
|
BLAKE2b-256 | 34baec1518154eff4ad022344fb10b30e0f355185ee30c822f5f135c72cbec01 |
Close
Hashes for ffpyplayer-4.3.1-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e5e3a11df8f07b171384137707fd26df81bedd1762ebd8f43f002d80d8e6176 |
|
MD5 | 3ad014c6481e428595dc934328578c7c |
|
BLAKE2b-256 | e9fc5a434912088b617a8344d957f587d7c9062968f0cecf2d58ae4ca1c56a6e |
Close
Hashes for ffpyplayer-4.3.1-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 | 95a34f60efc48fe2d3f08277d01559f4b1c6e1b2bc8dad14f2ce34191193f6c5 |
|
MD5 | 87e63cceeb0056b535d958b616fce800 |
|
BLAKE2b-256 | 928811e9d1a392769166b6faecbfa3bf9bec01f7ed01b8195e1e025a8304ee88 |
Close
Hashes for ffpyplayer-4.3.1-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17bdfd39573e649d3976006340634ed27c2312fa483d4166d68c85ed85f5ee96 |
|
MD5 | 191d1e4e3c6c6b1e204e508392cd2ef1 |
|
BLAKE2b-256 | 66a3f2d41b82c3af667f5f2570e97494a3783238582cea554a13ccf64a985863 |