TorchCodec 0.14:支持 CPU 和 CUDA 的 HDR 视频解码,以及高速音频解码器
TorchCodec 0.14: HDR Video Decoding for CPU and CUDA, and Fast Wav Decoder

原始链接: https://github.com/meta-pytorch/torchcodec/releases/tag/v0.14.0

TorchCodec 0.14 已发布,要求 PyTorch 2.11 或更高版本。本次更新引入了两项重要功能: * **Fast WavDecoder:** 一个专用于 WAV 文件的全新解码器,跳过 FFmpeg 以显著提升性能。它支持多种采样格式及输入类型(文件、字节流或类文件对象)。 * **HDR 视频解码:** `VideoDecoder` 现已支持 HDR 视频,可输出高精度的 RGB float32 帧。此测试版功能同时适用于 CPU 和 CUDA。 **其他关键改进与修复包括:** * **增强音频寻轨:** 提升了 `AudioDecoder` 的寻轨性能。 * **简化安装:** 该库移除了对 NVIDIA NPP 库的依赖,简化了 CUDA 的配置过程。 * **错误修复:** 修复了 CUDA 销毁时可能发生的罕见崩溃问题,以及视频尺寸为奇数时 CUDA 解码出现的问题。 有关更多详细信息,请参阅官方 TorchCodec 文档。

```Hacker News最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交登录TorchCodec 0.14:支持CPU与CUDA的HDR视频解码,以及快速WAV解码器 (github.com/meta-pytorch)18点 由 scott_s 发布于 4 小时前 | 隐藏 | 过往 | 收藏 | 2条评论 帮助 Reubend 27 分钟前 | 下一条 [–] WAV 文件解码性能的提升也非常受欢迎!回复scott_s 4 小时前 | 上一条 [–] 作为披露,我参与了 TorchCodec 的开发。我很乐意回答任何问题!回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索: ```
相关文章

原文

TorchCodec 0.14 is out! It is compatible with torch >= 2.11. It comes with two major additions: a fast audio WavDecoder, and support for HDR video decoding!

Fast wav decoder

TorchCodec now has a dedicated WavDecoder for decoding WAV files. It bypasses FFmpeg entirely and reads WAV data directly, resulting in significantly faster decoding. It supports multiple sample formats (int16, int32, float32, etc.), and can decode from files, bytes, or file-like objects.

from torchcodec.decoders import WavDecoder

decoder = WavDecoder("audio.wav")
samples = decoder.get_all_samples()  # AudioSamples with data and sample_rate

Read more in our docs.

HDR Video Decoding

VideoDecoder now supports HDR (High Dynamic Range) video decoding without losing precision. When output_dtype=torch.float32 is specified, the decoder outputs RGB float32 frames in [0, 1], preserving the full HDR color range. This is supported for both CPU and CUDA!

import torch
from torchcodec.decoders import VideoDecoder

decoder = VideoDecoder("hdr_video.mp4", output_dtype=torch.float32)
frame = decoder[0]  # Full HDR precision in float32

Read more in our docs.

⚠️ This feature is in beta stage, so behavior may slightly change depending on user feedback. Let us know if you encounter any issue!

Other Improvements

  • Improved audio seeking: AudioDecoder seeking is now much faster (#1449)
  • Dropped NPP dependency: TorchCodec no longer depends on NVIDIA's NPP library, which will simplify installing and using TorchCodec for CUDA decoding.

Bug Fixes

  • Fix a rare crash scenario during process teardown with the CUDA decoder (#1441)
  • Fix CUDA decoding of videos with odd dimensions(#1462)
联系我们 contact @ memedata.com