TorchCodec 0.10
TorchCodec 0.10 is out! It is compatible with torch 2.10, and comes with exciting new features.
Decoder Transforms
Decoder Transforms are available! We have released Resize, CenterCrop, RandomCrop, which can be used in VideoDecoder to transform data during preprocessing:
resize_decoder = VideoDecoder(
video_path,
transforms= [
torchcodec.transforms.RandomCrop(size=(1280, 1664)),
torchcodec.transforms.Resize(size=(480, 640)),
]
)
resized_frame = resize_decoder[5]
Read more about this in the tutorial!
Let us know any transforms you want to see added in https://github.com/meta-pytorch/torchcodec/issues/1134!
Video Encoding on GPU
VideoEncoder now supports encoding on GPU! This can improve performance by ~3x! To use it, simply move the input frames onto the CUDA device before encoding:
encoder = VideoEncoder(frames=frames.cuda(), frame_rate=frame_rate)
encoder.to_file(dest="output.mp4", codec="h264_nvenc")
Performance Tips guide
Check out our new performance tips guide to read about best practices to improve performance! The guide covers batch APIs, decoding seek modes, multi-threading, GPU decoding, and checking for CPU fallback during decoding.
Enhancements
- We've added a detailed stack trace when FFmpeg is not found. This should help debug installation issues on various development environments. (https://github.com/meta-pytorch/torchcodec/pull/1138)
- On MacOS, we've improved Homebrew FFmpeg discoverability. (https://github.com/meta-pytorch/torchcodec/pull/1152, https://github.com/meta-pytorch/torchcodec/pull/1175, https://github.com/meta-pytorch/torchcodec/pull/1177)