|
1 | | -# viteo |
| 1 | +<div align="center"> |
2 | 2 |
|
3 | | -High-performance video frame extraction for Apple Silicon using AVFoundation/VideoToolbox with MLX integration. |
| 3 | +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" height="200px" width="400px" viewBox="0 0 400 100"> |
| 4 | + <defs> |
| 5 | + <linearGradient x1="87.9681034%" y1="50%" x2="1.27351722%" y2="50%" id="linearGradient-1"> |
| 6 | + <stop offset="0%" stop-color="#174889"></stop> |
| 7 | + <stop offset="67.6877392%" stop-color="#7c46ce"></stop> |
| 8 | + <stop offset="100%" stop-color="#c1c8ca"></stop> |
| 9 | + </linearGradient> |
| 10 | + </defs> |
| 11 | + <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" font-family="Arial-BoldMT, Arial" font-weight="bold"> |
| 12 | + <g id="gh-banner"> |
| 13 | + <text id="gh-title-reflection" fill="url(#linearGradient-1)" font-size="72"> |
| 14 | + <tspan x="200" y="120" text-anchor="middle">viteo</tspan> |
| 15 | + </text> |
| 16 | + </g> |
| 17 | + </g> |
| 18 | +</svg> |
4 | 19 |
|
5 | | -## Usage |
| 20 | +**High-performance video frame extraction for Apple Silicon** |
| 21 | + |
| 22 | +[](https://www.python.org/downloads/) |
| 23 | +[](https://www.apple.com/mac/) |
| 24 | +[](https://opensource.org/licenses/MIT) |
| 25 | + |
| 26 | +</div> |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +- **Hardware-accelerated** extraction using AVFoundation/VideoToolbox |
| 31 | +- **MLX native** with direct BGRA frame copy to `mx.array` |
| 32 | +- **Lightweight bindings** using `nanobind` and GIL release |
| 33 | +- **Pythonic** interface with simple iterators and context managers |
| 34 | + |
| 35 | +<br /> |
| 36 | + |
| 37 | +## Getting started |
6 | 38 |
|
7 | 39 | ```python |
8 | 40 | import viteo |
9 | 41 |
|
10 | | -# Simple iteration |
| 42 | +# Simple iteration with context manager |
11 | 43 | with viteo.open("video.mp4") as frames: |
12 | 44 | for frame in frames: |
13 | 45 | # frame is MLX array (height, width, 4) BGRA format |
14 | 46 | process(frame) |
15 | 47 |
|
16 | | -# Or direct extraction |
| 48 | +# Direct extraction |
17 | 49 | extractor = viteo.FrameExtractor("video.mp4") |
18 | 50 | for frame in extractor: |
19 | 51 | process(frame) |
20 | 52 | ``` |
21 | 53 |
|
22 | 54 | ## Installation |
23 | 55 |
|
24 | | -> **PyPI package coming very soon!** |
| 56 | +> **Note:** PyPI package coming very soon! |
| 57 | +
|
| 58 | +### From source |
25 | 59 |
|
26 | 60 | ```bash |
27 | 61 | git clone https://github.com/codeSamuraii/viteo |
28 | 62 | cd viteo |
29 | 63 | pip install -v -e . |
30 | 64 | ``` |
31 | 65 |
|
32 | | -Building/rebuilding the package in editable mode: |
| 66 | +#### Rebuilding |
| 67 | + |
33 | 68 | ```bash |
34 | 69 | rm -rf dist/ |
35 | 70 | pip install -e . --force-reinstall --no-deps |
36 | 71 | ``` |
37 | 72 |
|
38 | | -## Key Features |
39 | | - |
40 | | -- **Hardware acelerated**: Zero-copy extraction using VideoToolbox with Metal compatibility |
41 | | -- **MLX native**: Direct integration with MLX arrays for GPU-ready processing |
42 | | -- **Optimized bindings**: `nanobind` extension with internal batching and GIL release for maximum throughput |
43 | | - |
44 | | -## Architecture |
45 | | - |
46 | | -The extension implements a three-layer architecture optimized for performance: |
47 | | - |
48 | | -**C++ Core** (`frame_extractor.h/mm`) |
49 | | -- Minimal interface with only essential operations (open, extract_batch, reset) |
50 | | -- Direct CVPixelBuffer to memory copy with fast-path optimization |
51 | | -- Cached video properties and frame-level seeking support |
52 | | - |
53 | | -**Objective-C++ Backend** |
54 | | -- AVFoundation/VideoToolbox integration with hardware acceleration |
55 | | -- IOSurface backing and Metal compatibility for GPU transfers |
56 | | -- Native BGRA format to avoid color conversion overhead |
57 | | - |
58 | | -**Python Bindings** (`bindings.cpp`) |
59 | | -- Custom iterator using nanobind for minimal overhead |
60 | | -- Direct buffer protocol integration with MLX arrays |
61 | | -- Automatic batch management transparent to users |
62 | | - |
63 | | -## License |
| 73 | +### Requirements |
64 | 74 |
|
65 | | -MIT |
| 75 | +- macOS with Apple Silicon (M1/M2/M3/M4) |
| 76 | +- Python 3.8+ |
| 77 | +- MLX framework |
0 commit comments