meta-pytorch/torchcodec
Media decoding and encoding for PyTorch: videos, images, and audio, on CPU and GPU.
What it solves
TorchCodec simplifies the process of loading and saving media files—such as videos, audio, and images—directly into PyTorch tensors. It removes the complexity of interacting with low-level media libraries, providing a streamlined, developer-friendly way to prepare data for machine learning training and inference.
How it works
TorchCodec acts as a bridge between media files and the PyTorch ecosystem. For video and audio, it leverages the mature FFmpeg library to handle decoding and encoding, abstracting away the difficult parts of the FFmpeg API. For images, it provides built-in support for common formats like JPEG, PNG, and WebP. All data is returned as PyTorch tensors, allowing it to be used immediately in your existing PyTorch workflows.
Who it’s for
This library is designed for machine learning engineers and researchers who need to efficiently process media data within PyTorch pipelines on either CPU or CUDA-enabled GPUs.
Highlights
- PyTorch-Native: Seamlessly converts media into tensors ready for model training or inference.
- Hardware Acceleration: Supports decoding and encoding on both CPU and CUDA GPUs.
- Pythonic API: Uses intuitive, standard Python and PyTorch conventions for indexing and data handling.
- Format Support: Handles a wide range of media, including video, audio, and various image formats like JPEG, PNG, and HEIC.
- Flexible Integration: Uses existing system FFmpeg installations for video and audio, keeping the library lightweight.
Related
- Project
- Project
- Project
- Project
- Project