PyTorch releases TorchCodec 1.0 with stable low-level decoding APIs
Developers can supply their own compressed packets and codec settings, then process decoded video frames before converting them to RGB tensors.
PyTorch released TorchCodec 1.0, making its low-level audio and video decoding APIs stable. Version 1.0.0 is available on PyPI. The library decodes video, audio and images into PyTorch tensors and can encode tensors back into media.
The low-level APIs give developers separate control over reading compressed packets, decoding them and converting the output to tensors. Applications can supply compressed packets and the stream’s codec settings directly to the audio or video packet decoder, so they can decode packets received over a network or saved in a database. PyTorch lists raw H.264 and HEVC camera streams as examples of inputs that can be decoded without a media container.
For a container such as MP4, Demuxer extracts compressed packets from the selected stream. VideoPacketDecoder turns those packets into raw frames, and ColorConverter converts the frames to red, green and blue (RGB) tensors. For audio, AudioPacketDecoder produces raw samples, and AudioConverter converts them to normalized 32-bit floating-point values and can change the sample rate or channel mix.
Applications can also work directly with raw frames or samples. PyTorch gives the example of combining color conversion and resizing in one custom step. The high-level VideoDecoder and AudioDecoder still handle all three stages together.
PyTorch reports no breaking changes to the low-level decoding APIs it introduced in the 0.17 beta, when PyTorch said signatures and behavior could still change based on feedback. The project recommends constructing a video packet decoder with VideoPacketDecoder(stream.codec_parameters) and still supports stream.make_decoder(). In a separate compatibility change, exceptions raised by read(), write() or seek() on file-like objects supplied by an application now surface as RuntimeError with the original error in the message.
The release requires PyTorch 2.11 or later and raises the minimum Python version from 3.10 to 3.11. Audio and video decoding require FFmpeg. Developers can install TorchCodec 1.0.0 from PyPI, which lists four wheels tagged for Linux x86-64 and ARM64 with glibc 2.27 or later, macOS 14 or later on ARM64, and Windows x86-64.
More news

Mistral adds Z.ai’s GLM-5.4 to its EU cloud API

Self Storage Manager announces MCP connector for external AI assistants

Firmable opens its self-serve Data API to developers and AI agents
