# meta-pytorch/torchcodec

Media decoding and encoding for PyTorch: videos, images, and audio, on CPU and GPU.

Repository: https://github.com/meta-pytorch/torchcodec
Canonical: https://ross.abutalabs.com/products/torchcodec
Homepage: http://meta-pytorch.org/torchcodec/
Language: Python
License: BSD-3-Clause
License Family: permissive
Last push: 2026-09-02T23:55:58+00:00

## Health v2 (maintenance only)
Score: 87/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 100, release rhythm 85, longevity 59
- inputs: {"age_days": 826, "days_push": 0, "days_rel": 20, "gap_med": 32, "n_releases_24m": 20}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1160, forks 123 (observed 2026-09-03T02:15:14.919418+00:00)

## What it is
TorchCodec is a PyTorch-native library for decoding and encoding videos, audio, and images into PyTorch tensors on CPU and CUDA GPU, built on top of FFmpeg. It provides Pythonic APIs for frame-level video access, audio decoding, and encoding, designed for ML training and inference pipelines.

## Use cases
- decode video files into pytorch tensors for training
- load video frames by index or timestamp for model training
- decode audio into tensors for speech models
- encode tensors back into video or audio files
- gpu-accelerated video decoding with cuda
- convert images to tensors without ffmpeg
- build video data loading pipelines for pytorch

## When to choose
- you train or run inference with PyTorch on video, audio, or image data
- you want tensors directly instead of numpy arrays or raw frames
- you need fast GPU (CUDA) media decoding
- you want a simple Pythonic API over FFmpeg's complexity

## When to avoid
- you need a general-purpose media tool like ffmpeg CLI
- your project does not use PyTorch
- you need exotic codecs or container formats outside FFmpeg's coverage
- you need streaming playback rather than tensor decoding

## Facets
- artifact type: library
- maturity: active
- function: video-processing, audio-processing, image-processing, machine-learning
- domain: machine-learning, deep-learning, media, image-processing
- platform: python, windows, cross-platform
- tags: pytorch, ffmpeg, tensor, media-decoding, media-encoding, cuda, video-decoder, data-loading, video, audio, linux, macos, gpu

## Member repositories
- meta-pytorch/torchcodec (main) score 87

## Provenance
- Observed fields: from GitHub, fetched 2026-09-03T02:15:14.919418+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:31:58.134186+00:00, confidence not recorded.
  - readme: https://github.com/meta-pytorch/torchcodec (fetched 2026-09-03T02:15:14.919418+00:00, sha dcd7c5813daa)
  - homepage: http://meta-pytorch.org/torchcodec/ (fetched 2026-08-29T12:36:46.545529+00:00, sha fc4bcdccfb7c)
- Data as of 2026-08-30T08:39:29.467469+00:00.
