Install & Compatibility
Where this runs
tested against v1.2.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 3.200s · 240.8MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 11.1s · import 2.994s · 233MB
238MB installed
● package 238MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
mediapy
✓ import mediapy
✗ import mediapy
This quickstart demonstrates how to read and display both local/remote images and videos. For video functionality, ensure that the `ffmpeg` command-line tool is installed and accessible in your system's PATH. An example of writing an image to a file is also included.
import mediapy as media
import numpy as np
import shutil
import os
# --- Image Example ---
image_url = 'https://github.com/hhoppe/data/raw/main/image.png'
print(f"Reading image from: {image_url}")
image = media.read_image(image_url)
print(f"Image shape: {image.shape}, dtype: {image.dtype}")
media.show_image(image, title='Remote Image')
# Example of creating and saving an image
checkerboard = np.kron([[0, 1] * 16, [1, 0] * 16] * 16, np.ones((4, 4)))
output_image_path = '/tmp/checkerboard.png'
media.write_image(output_image_path, checkerboard)
print(f"\nCheckerboard image written to {output_image_path}")
# --- Video Example (requires ffmpeg) ---
if shutil.which('ffmpeg'):
video_url = 'https://github.com/hhoppe/data/raw/main/video.mp4'
print(f"\nReading video from: {video_url}")
video = media.read_video(video_url)
print(f"Video shape: {video.shape}, dtype: {video.dtype}")
if hasattr(video, 'metadata') and hasattr(video.metadata, 'fps'):
print(f"Video framerate: {video.metadata.fps} fps")
media.show_video(video, title='Remote Video', fps=video.metadata.fps)
else:
media.show_video(video, title='Remote Video - FPS unknown')
else:
print("\nFFmpeg is not installed or not in PATH. Skipping video example.")
print("Please install ffmpeg (e.g., 'brew install ffmpeg' on macOS, 'apt install ffmpeg' on Debian/Ubuntu) for video functionality.")
Upgrade
Version history
1.2.7latest on PyPI · released Jul 1, 2026
Audit
Dependencies
numpyrequiredFundamental for image and video data handling as NumPy arrays.
pillowrequiredUsed for image processing tasks.
ffmpegrequiredExternal command-line tool required for all video input/output operations. Must be installed separately and accessible in system PATH.