pytorch / audio

Data manipulation and transformation for audio signal processing, powered by PyTorch
https://pytorch.org/audio
BSD 2-Clause "Simplified" License
2.43k stars 635 forks source link

Support for 10bit / 12bit encoding (e.g. yuv420p10le) in StreamWriter #3776

Open tvercaut opened 2 months ago

tvercaut commented 2 months ago

🚀 The feature

The ability to provide 16 bit data (torch.int16) as input to StreamWriter with the understanding that the data will be truncated to 10/12 bit depending on the selected encoder_format would be very helpful.

Motivation, pitch

10 bit video encoding is becoming more mainstream and is supported in nvenc. 12 bit video encoding is also getting more traction. torchaudio already supports reading 10 bit video and storing it in 16 bit tensors: https://github.com/pytorch/audio/issues/3331 https://github.com/pytorch/audio/pull/3023 https://github.com/pytorch/audio/pull/3332 It would be great to have the converse support on the encoding side.

Alternatives

Additional context

N/A