Skip to main content

Video loading and preprocessing utilities for MLX on Apple Silicon

Project description

mlx-video

mlx-video is a small video preprocessing library for MLX on Apple Silicon.

GitHub: https://github.com/AmiraniLabs/mlx-video

It focuses on the first mile of video ML:

  • load video files into mlx.core.array
  • sample frames at a target FPS
  • resize clips for model input
  • convert uint8 frames to normalized float32 tensors

Install

pip install mlx-video

Publishing

This package is configured for PyPI Trusted Publishing from the AmiraniLabs/mlx-video GitHub repository using .github/workflows/publish.yml.

Quickstart

import mlx_video as mv

frames = mv.load("video.mp4", fps=8)         # mx.array [T, H, W, C], uint8 RGB
frames = mv.resize(frames, (224, 224))       # spatial resize
frames = mv.normalize(frames)                # float32, ImageNet normalized

API

load(path, fps=None, start_time=None, end_time=None, max_frames=None)

Loads a video into a mx.array with shape [T, H, W, C] in RGB order.

resize(frames, size)

Resizes each frame to (height, width).

to_float(frames, scale=True)

Casts frames to float32. By default values are scaled to [0, 1].

normalize(frames, mean=..., std=...)

Applies channel-wise normalization using ImageNet defaults. Integer inputs are automatically converted to floating point and scaled before normalization.

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

mlx_video-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlx_video-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file mlx_video-0.1.0.tar.gz.

File metadata

  • Download URL: mlx_video-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mlx_video-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4c5059701cec1db33700dbbb1d63ac2b95edad73974a504ffde28b2b2c396639
MD5 a42ce197942fc5fc275e5f15aefd0ba1
BLAKE2b-256 c8f0fbb9393abb8d52f22f52f148f2c28f62cafee11f708459254d5afb71f080

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlx_video-0.1.0.tar.gz:

Publisher: publish.yml on AmiraniLabs/mlx-video

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mlx_video-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mlx_video-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mlx_video-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 21f2dffd22654c8818896bd66b31c536769db0e67b1e1ec68fd1be2836e37588
MD5 82487b99f1bd99c0d484c239159979ad
BLAKE2b-256 0e9a00fdfeb48a24e3a046e55ffae7b4bc1d1cd5d53cccfbc354af103cb9fdcd

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlx_video-0.1.0-py3-none-any.whl:

Publisher: publish.yml on AmiraniLabs/mlx-video

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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