Use Upstream PR: "Fix: Error creating video when sliced audio tensor chunks are non-c-contiguous" (#127)

This commit is contained in:
Christian Byrne 2025-05-04 20:13:19 -07:00 committed by GitHub
parent cb9f13ea08
commit 3a04204713
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -253,7 +253,12 @@ class VideoFromComponents(VideoInput):
start = i * samples_per_frame
end = start + samples_per_frame
# TODO(Feature) - Add support for stereo audio
chunk = self.__components.audio['waveform'][0, 0, start:end].unsqueeze(0).numpy()
chunk = (
self.__components.audio["waveform"][0, 0, start:end]
.unsqueeze(0)
.contiguous()
.numpy()
)
audio_frame = av.AudioFrame.from_ndarray(chunk, format='fltp', layout='mono')
audio_frame.sample_rate = audio_sample_rate
audio_frame.pts = i * samples_per_frame