torchcodec
A video decoder for PyTorch
Decision gist · record as of 2026-08-14
Yes, if you need to work with video, audio, or images in a media pipeline. TorchCodec is actively maintained (release 1 day old), has no known vulnerabilities, and integrates cleanly into workflows. Install friction is moderate due to compiled wheels and optional FFmpeg dependency, but both are straightforward. License status is unclear, so verify licensing terms before use in proprietary projects.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- FFmpeg (optional but required for video/audio; image decoders work without it).
- Requires Python >=3.10.
- Medium install friction due to compiled wheels for multiple Python versions (3.10–3.14) and platforms, plus an optional FFmpeg system dependency for video/audio work.
License · maintenance · safety
(unclear)
last release 2026-08-13 (1 days) · last repo commit 2026-08-14 · 1,156 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 4,207,756 downloads/mo, #2,362 on PyPI
Alternatives
Verify before relying
pip install torchcodec
from torchcodec.decoders import VideoDecoder
decoder = VideoDecoder("path/to/video.mp4", device="cpu")
frame = decoder[0] # uint8 tensor [C, H, W]- Whether CUDA wheels are available for Windows by default or require explicit --index-url configuration
- Performance characteristics (speed, memory efficiency) compared to direct FFmpeg usage
- Stability and maturity of the 0.16.0 release relative to earlier versions
What it is and what it does
TorchCodec is a library that converts video, audio, and image files into tensors and back. It wraps FFmpeg for video and audio decoding/encoding, providing Pythonic APIs that abstract FFmpeg's complexity while supporting both CPU and CUDA GPU acceleration. The library returns data as tensors ready for transforms or model training, with metadata like frame counts, timestamps, and codec information.
The package handles video frame indexing by frame number or playback time, batch frame extraction with timing metadata, and image decoding/encoding in multiple formats (JPEG, PNG, WebP, GIF, AVIF, HEIC). FFmpeg is optional—image codecs work without it—but video and audio work requires FFmpeg 4–9 installed on your system. CUDA support depends on GPU hardware with NVDEC/NVENC capabilities.
Use it for
- Extract video frames as tensors for training models on video datasets
- Decode audio to tensors for speech or music processing in pipelines
- Batch-load images in multiple formats (JPEG, PNG, WebP) directly to GPU
- Encode outputs back to video or audio files with precise frame/sample timing
- Build data loaders that stream video frames with accurate presentation timestamps
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to work with video, audio, or images in a media pipeline.
TorchCodec is actively maintained (release 1 day old), has no known vulnerabilities, and integrates cleanly into workflows. Install friction is moderate due to compiled wheels and optional FFmpeg dependency, but both are straightforward. License status is unclear, so verify licensing terms before use in proprietary projects.
Install
torchcodec on PyPI
Before you install
Medium install friction due to compiled wheels for multiple Python versions (3.10–3.14) and platforms, plus an optional FFmpeg system dependency for video/audio work. Actively maintained with a release 1 day old and 1156 repository stars.
FFmpeg (optional but required for video/audio; image decoders work without it). Requires Python >=3.10.
Quickstart
pip install torchcodec
from torchcodec.decoders import VideoDecoder
decoder = VideoDecoder("path/to/video.mp4", device="cpu")
frame = decoder[0] # uint8 tensor [C, H, W]
Verify before relying
- Whether CUDA wheels are available for Windows by default or require explicit --index-url configuration
- Performance characteristics (speed, memory efficiency) compared to direct FFmpeg usage
- Stability and maturity of the 0.16.0 release relative to earlier versions
Package facts
| License | Not declared unclear |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,207,756 / month, #2,362 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: torchcodec-0.16.0-cp310-cp310-macosx_14_0_arm64.whl; torchcodec-0.16.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; torchcodec-0.16.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; torchcodec-0.16.0-cp310-cp310-win_amd64.whl; torchcodec-0.16.0-cp311-cp311-macosx_14_0_arm64.whl; torchcodec-0.16.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; torchcodec-0.16.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; torchcodec-0.16.0-cp311-cp311-win_amd64.whl; torchcodec-0.16.0-cp312-cp312-macosx_14_0_arm64.whl; torchcodec-0.16.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; torchcodec-0.16.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; torchcodec-0.16.0-cp312-cp312-win_amd64.whl; torchcodec-0.16.0-cp313-cp313-macosx_14_0_arm64.whl; torchcodec-0.16.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; torchcodec-0.16.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; torchcodec-0.16.0-cp313-cp313-win_amd64.whl; torchcodec-0.16.0-cp314-cp314-macosx_14_0_arm64.whl; torchcodec-0.16.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; torchcodec-0.16.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; torchcodec-0.16.0-cp314-cp314t-macosx_14_0_arm64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “video decoding pytorch”
- torchcodecTorchCodec decodes and encodes videos, audio, and images to and from…
- decordDecord decodes video and audio files with hardware-accelerated…
- decord2Decord2 decodes video and audio files with hardware acceleration,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also decord2 · decord · pynvvideocodec · torch · nvidia-nvimgcodec-cu12 · imageio-ffmpeg · python-ffmpeg · mediapy · torchlibrosa · qwen-omni-utils