🫧 Nitrox
Deep, fast, clean. Media processing at maximum depth.
Nitrox is a Python library for high performance audio and video processing. Built on ffmpeg with a clean, intuitive API.
Installation
pip install nitrox
With audio processing:
pip install nitrox[audio]
FFmpeg Requirement
Nitrox requires ffmpeg to be installed on your system.
macOS:
# Using Homebrew
brew install ffmpeg
Linux (Ubuntu/Debian):
sudo apt update
sudo apt install ffmpeg
Linux (RHEL/CentOS):
sudo dnf install ffmpeg
# or
sudo yum install ffmpeg
Other platforms: Download from ffmpeg.org
Quick Start
from nitrox import Media
# Basic usage
Media("input.mp4").slice(10, 30).to("output.mp4")
# Audio extraction
Media("video.mp4").extract_audio().to("audio.wav")
# Video processing
Media("input.mp4").resize(720, 480).to("resized.mp4")
Minimal Syntax
For power users, Nitrox offers an ultra-minimal X alias:
from nitrox import X
# Same functionality, minimal syntax
X("input.mp4")[10:30].to("output.mp4")
X("video.mov").extract_audio().to("audio.mp3")
Core Features
Intuitive Slicing
media = Media("video.mp4")
# Time-based slicing
media[0:10] # First 10 seconds
media[30:60] # From 30s to 60s
media[10:] # From 10s to end
media[:30] # First 30 seconds
Chainable Operations
# Video processing
Media("input.mp4") \
.slice(10, 60) \
.resize(1280, 720) \
.to("processed.mp4")
# Audio processing
Media("audio.wav") \
.normalize_audio() \
.fade_in(1.0) \
.fade_out(2.0) \
.to("clean.wav")
Audio Processing
# Basic audio operations
Media("input.mp3").resample(44100).to("output.wav")
Media("stereo.wav").to_mono().to("mono.wav")
# With numpy integration
audio_data = Media("song.wav")[10:20].to_numpy()
Media.from_numpy(audio_data, 44100).to("processed.wav")
Examples
Extract Highlights
# Extract multiple clips
video = Media("long_video.mp4")
highlights = [
video[0:30], # Opening
video[300:330], # Middle segment
video[1200:1230] # Ending
]
for i, clip in enumerate(highlights):
clip.to(f"highlight_{i}.mp4")
Podcast Processing
# Clean up podcast audio
Media("raw_recording.wav") \
.normalize_audio() \
.fade_in(0.5) \
.fade_out(1.0) \
.to("podcast_ready.mp3")
Batch Processing
# Process multiple files
import os
for filename in os.listdir("raw_videos/"):
if filename.endswith('.mp4'):
Media(f"raw_videos/{filename}") \
.resize(720, 480) \
.to(f"processed/{filename}")
API Reference
Core Operations
Video:
resize(width, height)- Resize videocrop(x, y, width, height)- Crop videoset_fps(fps)- Change frame rate
Audio:
extract_audio()- Extract audio tracknormalize_audio()- Normalize audio levelsresample(rate)- Change sample rateto_mono()- Convert to monofade_in(duration)- Add fade infade_out(duration)- Add fade out
Slicing:
slice(start, end)- Extract time range[start:end]- Python slice notation
Output:
to(path)- Save processed mediato_numpy()- Extract as numpy array (requires numpy)from_numpy(data, rate)- Create from numpy array (requires numpy)
Utility:
info()- Get media informationpreview_command()- Show ffmpeg command
Command Line
# Basic usage
nitrox slice input.mp4 output.mp4 --start 10 --end 30
nitrox resize video.mp4 small.mp4 --width 720 --height 480
nitrox convert video.mp4 audio.mp3 --extract-audio
# Get media info
nitrox info video.mp4
Requirements
- Python 3.8+
- ffmpeg (see installation instructions above)
- numpy (optional, for array processing)
License
MIT License - see LICENSE file.
**🫧 Nitrox **
Metadata
Release files for nitrox 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nitrox-0.1.1.tar.gz | 24.7 kB | Without provenance | Details for nitrox-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nitrox-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for nitrox-0.1.1-py3-none-any.whl |
Total release size: 40.6 kB
Release files / nitrox-0.1.1.tar.gz
| Download URL | nitrox-0.1.1.tar.gz |
|---|---|
| Size | 24.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77e5c15957af5abd1c55fee788245cde9e2b77d81d8d5274ea7a050a45ca4760
|
|
BLAKE2b-256 checksum How to use checksums |
6bced9b992f2b4849df32b6f56be793083eb5d5f76975edfb1fad84193dfa9fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Release files / nitrox-0.1.1-py3-none-any.whl
| Download URL | nitrox-0.1.1-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8554f5423747db0e3a4dfe2bf2f7acf4e124265c71bbd794567ca0c99c9e5f7
|
|
BLAKE2b-256 checksum How to use checksums |
d1904f115b54601fb9e6de60774ee41312e00b2f60bea936009175e7105e537e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Security for nitrox 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.