Skip to content

Commit af6a008

Browse files
authored
Attempt at fixing contiguity test failures (#1048)
1 parent c69739f commit af6a008

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/test_encoders.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -708,17 +708,20 @@ def test_contiguity(self, method, tmp_path):
708708
)
709709

710710
def encode_to_tensor(frames):
711+
common_params = dict(crf=0, pixel_format="yuv444p")
711712
if method == "to_file":
712713
dest = str(tmp_path / "output.mp4")
713-
VideoEncoder(frames, frame_rate=30).to_file(dest=dest)
714+
VideoEncoder(frames, frame_rate=30).to_file(dest=dest, **common_params)
714715
with open(dest, "rb") as f:
715716
return torch.frombuffer(f.read(), dtype=torch.uint8)
716717
elif method == "to_tensor":
717-
return VideoEncoder(frames, frame_rate=30).to_tensor(format="mp4")
718+
return VideoEncoder(frames, frame_rate=30).to_tensor(
719+
format="mp4", **common_params
720+
)
718721
elif method == "to_file_like":
719722
file_like = io.BytesIO()
720723
VideoEncoder(frames, frame_rate=30).to_file_like(
721-
file_like, format="mp4"
724+
file_like, format="mp4", **common_params
722725
)
723726
return torch.frombuffer(file_like.getvalue(), dtype=torch.uint8)
724727
else:

0 commit comments

Comments
 (0)