mediapy
Read/write/show images and videos in an IPython notebook
What it is and what it does
Mediapy is a library that integrates image and video I/O directly into IPython and Jupyter notebook environments. It wraps common operations—reading from URLs or files, displaying with optional sizing and titles, writing to disk—and returns media as numpy arrays so you can manipulate them with standard scientific Python tools. The library handles metadata like video framerate automatically and provides both high-level convenience functions (show_image, read_video) and lower-level streaming interfaces (VideoReader, VideoWriter) for frame-by-frame processing.
The package depends on matplotlib, numpy, and Pillow for image handling, plus ipython for notebook integration. Video I/O requires ffmpeg to be installed on your system PATH. It targets modern Python versions and is designed specifically for notebook workflows, making it most useful when you're already working interactively in Jupyter rather than in scripts.
Use it for:
- Display images fetched from URLs or local files directly in a notebook cell with optional height and title parameters.
- Read video files and play them back in a notebook with correct framerate, or extract individual frames as numpy arrays.
- Process video frame-by-frame using VideoReader/VideoWriter to apply transformations and save the result.
- Show multiple images side-by-side in a notebook grid for visual comparison of results.
- Generate synthetic test images or videos programmatically and display them immediately for inspection.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Mediapy reads, writes, and displays images and videos directly in IPython and Jupyter notebooks, returning them as numpy arrays for further processing.
Yes, if you work in Jupyter or IPython notebooks and need to display or manipulate images and videos. The low install friction, active maintenance, permissive license, and tight integration with the notebook environment make it a straightforward choice. The only gotcha is the ffmpeg system dependency for video I/O, which is documented and typically a one-time setup.
Install
mediapy on PyPI
pip
pip install mediapyuv
uv add mediapypoetry
poetry add mediapyInstalling mediapy
Before you install
Low friction install with four common runtime dependencies (ipython, matplotlib, numpy, Pillow). Actively maintained with a recent release 44 days ago.
License in practice
Licensed under Apache Software License (permissive), allowing use in most commercial and open-source projects without significant restriction.
Quickstart
pip install mediapy
import mediapy as media
import numpy as np
image = media.read_image('https://github.com/hhoppe/data/raw/main/image.png')
media.show_image(image)
video = media.read_video('https://github.com/hhoppe/data/raw/main/video.mp4')
media.show_video(video)
Video I/O requires ffmpeg to be installed and present in the system PATH; on Unix this can be installed via apt install ffmpeg.
Verify before relying
- Whether ffmpeg installation on Windows is straightforward or requires additional setup steps beyond the Unix apt install shown in the docs.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — ipython, matplotlib, numpy, Pillow |
| Maintenance | actively maintained — 44 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,143,601/month — #4,302 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mediapy-1.2.7-py3-none-any.whl
Tags
More Viewers packages
Pillow adds image processing capabilities to…
permissive · top 100 on PyPI
open3dOpen3D provides data structures and algorithms…
permissive · top 5,000 on PyPI
psd-toolspsd-tools reads and writes Adobe Photoshop…
permissive · top 15,000 on PyPI
earthengine-apiPython client library for Google Earth Engine,…
permissive · top 15,000 on PyPI
vncdotoolvncdotool is a command-line VNC client that…
permissive · top 15,000 on PyPI
KivyKivy is a Python framework for building…
permissive · top 15,000 on PyPI
imageio-ffmpegProvides a simple Python wrapper around ffmpeg…
permissive · top 5,000 on PyPI
moviepyMoviePy is a Python library for video editing…
permissive · top 5,000 on PyPI
py3DmolEmbeds an interactive 3D molecular viewer in…
permissive · top 15,000 on PyPI
PIMSPIMS provides a unified interface to read…
permissive · top 15,000 on PyPI
torchcodecTorchCodec decodes and encodes videos, audio,…
unclear · top 5,000 on PyPI
scikit-videoscikit-video reads, writes, and analyzes video…
permissive · top 5,000 on PyPI
ipywidgetsipywidgets provides interactive HTML widgets…
permissive · top 1,000 on PyPI
ffmpegWraps FFmpeg and FFprobe command-line tools to…
permissive · top 15,000 on PyPI
watermarkWatermark is an IPython magic extension that…
permissive · top 15,000 on PyPI
pyaaf2Read, write, and modify Advanced Authoring…
permissive · top 15,000 on PyPI