ffpyplayer


Nameffpyplayer JSON
Version 4.5.1 PyPI version JSON
download
home_pagehttps://matham.github.io/ffpyplayer/
SummaryA cython implementation of an ffmpeg based player.
upload_time2023-10-08 21:42:49
maintainer
docs_urlNone
authorMatthew Einhorn
requires_python
licenseLGPL3
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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

.. image:: https://travis-ci.org/matham/ffpyplayer.svg?branch=master
    :target: https://travis-ci.org/matham/ffpyplayer
    :alt: TravisCI status

.. image:: https://ci.appveyor.com/api/projects/status/nfl6tyiwks26ngyu/branch/master?svg=true
    :target: https://ci.appveyor.com/project/matham/ffpyplayer/branch/master
    :alt: Appveyor status

.. image:: https://img.shields.io/pypi/pyversions/ffpyplayer.svg
    :target: https://pypi.python.org/pypi/ffpyplayer/
    :alt: Supported Python versions

.. image:: https://img.shields.io/pypi/v/ffpyplayer.svg
    :target: https://pypi.python.org/pypi/ffpyplayer/
    :alt: Latest Version on PyPI

.. warning::

    Although the ffpyplayer source code is licensed under the LGPL, the ffpyplayer wheels
    for Windows and linux on PYPI are distributed under the GPL because the included FFmpeg binaries
    were compiled with GPL options.

    If you want to use it under the LGPL you need to compile FFmpeg yourself with the correct options.

    Similarly, the wheels bundle openssl for online camera support. However, releases are not made
    for every openssl release, so it is recommended that you compile ffpyplayer yourself if security
    is a issue.

Usage example
-------------

Playing a file:

.. code-block:: python

    >>> 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:

.. code-block:: python

    >>> 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:

.. code-block:: python

    >>> 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]

            

Raw data

            {
    "_id": null,
    "home_page": "https://matham.github.io/ffpyplayer/",
    "name": "ffpyplayer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Matthew Einhorn",
    "author_email": "matt@einhorn.dev",
    "download_url": "https://files.pythonhosted.org/packages/b9/e8/f99fa2fe4abbdcc2f80d4b24cf65f3a049566e2cb61ec099d80ac51f367d/ffpyplayer-4.5.1.tar.gz",
    "platform": null,
    "description": "FFPyPlayer is a python binding for the FFmpeg library for playing and writing\r\nmedia files.\r\n\r\nFor more information: https://matham.github.io/ffpyplayer/index.html\r\n\r\nTo install: https://matham.github.io/ffpyplayer/installation.html\r\n\r\n.. image:: https://travis-ci.org/matham/ffpyplayer.svg?branch=master\r\n    :target: https://travis-ci.org/matham/ffpyplayer\r\n    :alt: TravisCI status\r\n\r\n.. image:: https://ci.appveyor.com/api/projects/status/nfl6tyiwks26ngyu/branch/master?svg=true\r\n    :target: https://ci.appveyor.com/project/matham/ffpyplayer/branch/master\r\n    :alt: Appveyor status\r\n\r\n.. image:: https://img.shields.io/pypi/pyversions/ffpyplayer.svg\r\n    :target: https://pypi.python.org/pypi/ffpyplayer/\r\n    :alt: Supported Python versions\r\n\r\n.. image:: https://img.shields.io/pypi/v/ffpyplayer.svg\r\n    :target: https://pypi.python.org/pypi/ffpyplayer/\r\n    :alt: Latest Version on PyPI\r\n\r\n.. warning::\r\n\r\n    Although the ffpyplayer source code is licensed under the LGPL, the ffpyplayer wheels\r\n    for Windows and linux on PYPI are distributed under the GPL because the included FFmpeg binaries\r\n    were compiled with GPL options.\r\n\r\n    If you want to use it under the LGPL you need to compile FFmpeg yourself with the correct options.\r\n\r\n    Similarly, the wheels bundle openssl for online camera support. However, releases are not made\r\n    for every openssl release, so it is recommended that you compile ffpyplayer yourself if security\r\n    is a issue.\r\n\r\nUsage example\r\n-------------\r\n\r\nPlaying a file:\r\n\r\n.. code-block:: python\r\n\r\n    >>> from ffpyplayer.player import MediaPlayer\r\n    >>> import time\r\n\r\n    >>> player = MediaPlayer(filename)\r\n    >>> val = ''\r\n    >>> while val != 'eof':\r\n    ...     frame, val = player.get_frame()\r\n    ...     if val != 'eof' and frame is not None:\r\n    ...         img, t = frame\r\n    ...         # display img\r\n\r\nWriting a video file:\r\n\r\n.. code-block:: python\r\n\r\n    >>> from ffpyplayer.writer import MediaWriter\r\n    >>> from ffpyplayer.pic import Image\r\n\r\n    >>> w, h = 640, 480\r\n    >>> # write at 5 fps.\r\n    >>> out_opts = {'pix_fmt_in':'rgb24', 'width_in':w, 'height_in':h,\r\n    ...     'codec':'rawvideo', 'frame_rate':(5, 1)}\r\n    >>> writer = MediaWriter('output.avi', [out_opts])\r\n\r\n    >>> # Construct image\r\n    >>> size = w * h * 3\r\n    >>> buf = bytearray([int(x * 255 / size) for x in range(size)])\r\n    >>> img = Image(plane_buffers=[buf], pix_fmt='rgb24', size=(w, h))\r\n\r\n    >>> for i in range(20):\r\n    ...     writer.write_frame(img=img, pts=i / 5., stream=0)\r\n\r\nConverting images:\r\n\r\n.. code-block:: python\r\n\r\n    >>> from ffpyplayer.pic import Image, SWScale\r\n    >>> w, h = 500, 100\r\n    >>> size = w * h * 3\r\n    >>> buf = bytearray([int(x * 255 / size) for x in range(size)])\r\n\r\n    >>> img = Image(plane_buffers=[buf], pix_fmt='rgb24', size=(w, h))\r\n    >>> sws = SWScale(w, h, img.get_pixel_format(), ofmt='yuv420p')\r\n\r\n    >>> img2 = sws.scale(img)\r\n    >>> img2.get_pixel_format()\r\n    'yuv420p'\r\n    >>> planes = img2.to_bytearray()\r\n    >>> map(len, planes)\r\n    [50000, 12500, 12500, 0]\r\n",
    "bugtrack_url": null,
    "license": "LGPL3",
    "summary": "A cython implementation of an ffmpeg based player.",
    "version": "4.5.1",
    "project_urls": {
        "Homepage": "https://matham.github.io/ffpyplayer/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "89c166891cf75b1cafb0b9c0a04329038c454366b778fe3dbe9f8d1d9854a45e",
                "md5": "9bd8df8d9b7ad8445b00976302f18862",
                "sha256": "526853ad4a382d07c89abdddd882188c025a8fe1f4a9d7df81e52cf7973a0cec"
            },
            "downloads": -1,
            "filename": "ffpyplayer-4.5.1-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "9bd8df8d9b7ad8445b00976302f18862",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": null,
            "size": 60910939,
            "upload_time": "2023-10-08T21:41:52",
            "upload_time_iso_8601": "2023-10-08T21:41:52.226259Z",
            "url": "https://files.pythonhosted.org/packages/89/c1/66891cf75b1cafb0b9c0a04329038c454366b778fe3dbe9f8d1d9854a45e/ffpyplayer-4.5.1-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ded6155d99a263c981f869f0e2640c57632a7e13b57613e219dd73ba8d21a287",
                "md5": "a6061377042a6b81639a9fbe5efd2585",
                "sha256": "648cd55b621d41a9bb931d0f2066a775dd2f0a26fcfebbe5df2b5c02555a7e83"
            },
            "downloads": -1,
            "filename": "ffpyplayer-4.5.1-cp311-cp311-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "a6061377042a6b81639a9fbe5efd2585",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": null,
            "size": 60900831,
            "upload_time": "2023-10-08T21:41:35",
            "upload_time_iso_8601": "2023-10-08T21:41:35.153928Z",
            "url": "https://files.pythonhosted.org/packages/de/d6/155d99a263c981f869f0e2640c57632a7e13b57613e219dd73ba8d21a287/ffpyplayer-4.5.1-cp311-cp311-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c73152b0daba77a23165ec3c4cad76af38cbec8d0accbb7d501f81655e0dadec",
                "md5": "cf3d1c1e215542950e3348f6befa7479",
                "sha256": "72aca90146d4276d89bd19a50d544ff2939260fd656a30c9b412598358d9fbc8"
            },
            "downloads": -1,
            "filename": "ffpyplayer-4.5.1-cp312-cp312-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "cf3d1c1e215542950e3348f6befa7479",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": null,
            "size": 60897799,
            "upload_time": "2023-10-08T21:42:45",
            "upload_time_iso_8601": "2023-10-08T21:42:45.951303Z",
            "url": "https://files.pythonhosted.org/packages/c7/31/52b0daba77a23165ec3c4cad76af38cbec8d0accbb7d501f81655e0dadec/ffpyplayer-4.5.1-cp312-cp312-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eb1d562ff3303228219ab9de549d41c8e730d2fb42a54429ec6f8581668d16cd",
                "md5": "b6ce3b3fa3a3c639037722b9b6ce51fe",
                "sha256": "b234b87f8872e7cb0fae5447422a36adbc331bab5a1552290e7bef29b2acf70b"
            },
            "downloads": -1,
            "filename": "ffpyplayer-4.5.1-cp37-cp37m-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "b6ce3b3fa3a3c639037722b9b6ce51fe",
            "packagetype": "bdist_wheel",
            "python_version": "cp37",
            "requires_python": null,
            "size": 60908686,
            "upload_time": "2023-10-08T21:42:25",
            "upload_time_iso_8601": "2023-10-08T21:42:25.888132Z",
            "url": "https://files.pythonhosted.org/packages/eb/1d/562ff3303228219ab9de549d41c8e730d2fb42a54429ec6f8581668d16cd/ffpyplayer-4.5.1-cp37-cp37m-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ad76ac8dbf59312f8f96c5fba1a3340a95797d657fc46aafbab6081e8b14c6f3",
                "md5": "f76c5c3ad4e938a21bca067af158759d",
                "sha256": "5bfc079ed4481fa0b182433e861e1b22e740e92568f88a9ffabc3c821f6e01b4"
            },
            "downloads": -1,
            "filename": "ffpyplayer-4.5.1-cp38-cp38-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "f76c5c3ad4e938a21bca067af158759d",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": null,
            "size": 60918159,
            "upload_time": "2023-10-08T21:42:21",
            "upload_time_iso_8601": "2023-10-08T21:42:21.051029Z",
            "url": "https://files.pythonhosted.org/packages/ad/76/ac8dbf59312f8f96c5fba1a3340a95797d657fc46aafbab6081e8b14c6f3/ffpyplayer-4.5.1-cp38-cp38-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8f29912aa8add74584d0531160ccf907e67de4de2b6363d964b6536664f6a962",
                "md5": "20164df09617f0dc7382877ec2926d1c",
                "sha256": "86920b16736d361b81f780ac8e1441f91966b5f1d1abe275981382c8cf8f0487"
            },
            "downloads": -1,
            "filename": "ffpyplayer-4.5.1-cp39-cp39-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "20164df09617f0dc7382877ec2926d1c",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": null,
            "size": 60917516,
            "upload_time": "2023-10-08T21:42:02",
            "upload_time_iso_8601": "2023-10-08T21:42:02.960985Z",
            "url": "https://files.pythonhosted.org/packages/8f/29/912aa8add74584d0531160ccf907e67de4de2b6363d964b6536664f6a962/ffpyplayer-4.5.1-cp39-cp39-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b9e8f99fa2fe4abbdcc2f80d4b24cf65f3a049566e2cb61ec099d80ac51f367d",
                "md5": "460b4e1912863cdf920839168cd4510d",
                "sha256": "d55d54563fcf6c334505b45d4b64825f24fafb5acfa7a9e472c08e877f549069"
            },
            "downloads": -1,
            "filename": "ffpyplayer-4.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "460b4e1912863cdf920839168cd4510d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 88898,
            "upload_time": "2023-10-08T21:42:49",
            "upload_time_iso_8601": "2023-10-08T21:42:49.736628Z",
            "url": "https://files.pythonhosted.org/packages/b9/e8/f99fa2fe4abbdcc2f80d4b24cf65f3a049566e2cb61ec099d80ac51f367d/ffpyplayer-4.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-08 21:42:49",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ffpyplayer"
}
        
Elapsed time: 0.13942s