for coderabbit

This commit is contained in:
Yousef Rafat 2026-07-03 18:18:43 +03:00
parent 537e3039dc
commit 54f340ce12

View File

@ -1144,6 +1144,9 @@ def _encode_image(
codec.pix_fmt = stream_fmt codec.pix_fmt = stream_fmt
codec.time_base = Fraction(1, 1) codec.time_base = Fraction(1, 1)
if num_channels == 1:
img_np = img_np.squeeze(-1)
frame = av.VideoFrame.from_ndarray(img_np, format=frame_fmt) frame = av.VideoFrame.from_ndarray(img_np, format=frame_fmt)
if frame_fmt != stream_fmt: if frame_fmt != stream_fmt:
frame = frame.reformat(format=stream_fmt) frame = frame.reformat(format=stream_fmt)