Skip to main content

Create videos from numpy arrays in a jupyter notebook

Project description

Video from numpy array in Jupyter Notebook

PyPI version

Create videos from numpy arrays in a jupyter notebook

Original source from Alexander Mordvintsev

Install

pip install notebook-video-writer

Dependencies

  • Must have ffmpeg installed

Usage

import numpy as np
# optionally wrap with tqdm for progress bar
from tqdm import tqdm
from notebook_video_writer import VideoWriter

with VideoWriter(fps=40) as vw:
    for i in tqdm(range(100)):
        frame = np.random.rand(256,256,3)
        vw.add(frame)

This will immediately display the video inline below the cell:

screenshot

An mp4 file is also saved to the current directory. Default name is _autoplay.mp4, but can be set with name keyword arg.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

notebook-video-writer-0.0.5.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

notebook_video_writer-0.0.5-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page