make audio chunks contiguous before encoding

This commit is contained in:
bymyself 2025-05-04 19:29:35 -07:00
parent 80a44b97f5
commit 26265cd8d2

View File

@ -211,7 +211,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