ffmpegio-plugin-mpl


Nameffmpegio-plugin-mpl JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://python-ffmpegio.github.io/python-ffmpegio
Summaryffmpegio plugin to create videos from matploglib Figures
upload_time2023-03-19 01:10:44
maintainer
docs_urlNone
author
requires_python>=3.7
licenseGPL-2.0 License
keywords multimedia ffmpeg matplotlib
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            `ffmpegio_plugin_mpl`: ffmpegio plugin to output matplotlib figures
===================================================================

|pypi| |pypi-status| |pypi-pyvers| |github-license| |github-status|

.. |pypi| image:: https://img.shields.io/pypi/v/ffmpegio
  :alt: PyPI
.. |pypi-status| image:: https://img.shields.io/pypi/status/ffmpegio
  :alt: PyPI - Status
.. |pypi-pyvers| image:: https://img.shields.io/pypi/pyversions/ffmpegio
  :alt: PyPI - Python Version
.. |github-license| image:: https://img.shields.io/github/license/python-ffmpegio/python-ffmpegio
  :alt: GitHub License
.. |github-status| image:: https://img.shields.io/github/workflow/status/python-ffmpegio/python-ffmpegio/Run%20Tests
  :alt: GitHub Workflow Status

This plugin enables Python `ffmpegio` package to output matplotlib's Figure.

Installation
------------

To enable it, install along with `ffmpegio-core` or `ffmpegio` package:

.. code-block:: bash

   pip install ffmpegio-core # or ffmpegio if also performing media I/O
   pip install ffmpegio-plugin-mpl

The plugin will be automatically loaded whenever `ffmpegio` package is imported.

Example
-------

Create an MP4 video of `Matplotlib's animation example <https://matplotlib.org/stable/gallery/animation/simple_anim.html>`__.

.. code-block:: python

  import ffmpegio
  from matplotlib import pyplot as plt
  import numpy as np

    
  fig, ax = plt.subplots()

  x = np.arange(0, 2*np.pi, 0.01)
  line, = ax.plot(x, np.sin(x))

  interval=20 # delay in milliseconds
  save_count=50 # number of frames

  def animate(i):
      line.set_ydata(np.sin(x + i / 50))  # update the data.
      return line


  with ffmpegio.open(
    "output.mp4", # output file name
    "wv", # open file in write-video mode
    1e3/interval, # framerate in frames/second
    pix_fmt="yuv420p", # specify the pixel format (default is yuv444p)
  ) as f:
      for n in range(save_count):
          animate(n) # update figure
          f.write(fig) # write new frame


            

Raw data

            {
    "_id": null,
    "home_page": "https://python-ffmpegio.github.io/python-ffmpegio",
    "name": "ffmpegio-plugin-mpl",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "multimedia,ffmpeg,matplotlib",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/1f/73/3a109b0ca3f8946a16d75d13714c4ce7671cd5d5d80e6bbfa89674a3c4a7/ffmpegio-plugin-mpl-0.1.1.tar.gz",
    "platform": null,
    "description": "`ffmpegio_plugin_mpl`: ffmpegio plugin to output matplotlib figures\n===================================================================\n\n|pypi| |pypi-status| |pypi-pyvers| |github-license| |github-status|\n\n.. |pypi| image:: https://img.shields.io/pypi/v/ffmpegio\n  :alt: PyPI\n.. |pypi-status| image:: https://img.shields.io/pypi/status/ffmpegio\n  :alt: PyPI - Status\n.. |pypi-pyvers| image:: https://img.shields.io/pypi/pyversions/ffmpegio\n  :alt: PyPI - Python Version\n.. |github-license| image:: https://img.shields.io/github/license/python-ffmpegio/python-ffmpegio\n  :alt: GitHub License\n.. |github-status| image:: https://img.shields.io/github/workflow/status/python-ffmpegio/python-ffmpegio/Run%20Tests\n  :alt: GitHub Workflow Status\n\nThis plugin enables Python `ffmpegio` package to output matplotlib's Figure.\n\nInstallation\n------------\n\nTo enable it, install along with `ffmpegio-core` or `ffmpegio` package:\n\n.. code-block:: bash\n\n   pip install ffmpegio-core # or ffmpegio if also performing media I/O\n   pip install ffmpegio-plugin-mpl\n\nThe plugin will be automatically loaded whenever `ffmpegio` package is imported.\n\nExample\n-------\n\nCreate an MP4 video of `Matplotlib's animation example <https://matplotlib.org/stable/gallery/animation/simple_anim.html>`__.\n\n.. code-block:: python\n\n  import ffmpegio\n  from matplotlib import pyplot as plt\n  import numpy as np\n\n    \n  fig, ax = plt.subplots()\n\n  x = np.arange(0, 2*np.pi, 0.01)\n  line, = ax.plot(x, np.sin(x))\n\n  interval=20 # delay in milliseconds\n  save_count=50 # number of frames\n\n  def animate(i):\n      line.set_ydata(np.sin(x + i / 50))  # update the data.\n      return line\n\n\n  with ffmpegio.open(\n    \"output.mp4\", # output file name\n    \"wv\", # open file in write-video mode\n    1e3/interval, # framerate in frames/second\n    pix_fmt=\"yuv420p\", # specify the pixel format (default is yuv444p)\n  ) as f:\n      for n in range(save_count):\n          animate(n) # update figure\n          f.write(fig) # write new frame\n\n",
    "bugtrack_url": null,
    "license": "GPL-2.0 License",
    "summary": "ffmpegio plugin to create videos from matploglib Figures",
    "version": "0.1.1",
    "split_keywords": [
        "multimedia",
        "ffmpeg",
        "matplotlib"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e7cfbf104d81caabc79d945fc48ae2ee0ac35b88b346ad325ec5f9a7fae0ba7d",
                "md5": "04d4177c521ac9a8d738640b5437fea4",
                "sha256": "ed1f4cb262349e4db58472fdf5aa201cc7131315d23fe98c8aa687da0848474f"
            },
            "downloads": -1,
            "filename": "ffmpegio_plugin_mpl-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "04d4177c521ac9a8d738640b5437fea4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 10204,
            "upload_time": "2023-03-19T01:10:43",
            "upload_time_iso_8601": "2023-03-19T01:10:43.320786Z",
            "url": "https://files.pythonhosted.org/packages/e7/cf/bf104d81caabc79d945fc48ae2ee0ac35b88b346ad325ec5f9a7fae0ba7d/ffmpegio_plugin_mpl-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1f733a109b0ca3f8946a16d75d13714c4ce7671cd5d5d80e6bbfa89674a3c4a7",
                "md5": "44a6b444cb78f5968d689d76a80d1f52",
                "sha256": "7eb724ef6e1fb7a483ab66114a5c14ee0a72886bf3125b7011e4d73bc56f63fa"
            },
            "downloads": -1,
            "filename": "ffmpegio-plugin-mpl-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "44a6b444cb78f5968d689d76a80d1f52",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10350,
            "upload_time": "2023-03-19T01:10:44",
            "upload_time_iso_8601": "2023-03-19T01:10:44.980501Z",
            "url": "https://files.pythonhosted.org/packages/1f/73/3a109b0ca3f8946a16d75d13714c4ce7671cd5d5d80e6bbfa89674a3c4a7/ffmpegio-plugin-mpl-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-19 01:10:44",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "ffmpegio-plugin-mpl"
}
        
Elapsed time: 0.04648s