mirror of
https://github.com/wiltodelta/remove-ai-watermarks.git
synced 2026-08-10 08:00:32 +02:00
Bound ffmpeg video encoder threads
This commit is contained in:
+5
-10
@@ -1950,17 +1950,19 @@ class TestVideoVisibleScan:
|
||||
|
||||
|
||||
class TestVideoVisibleEncoding:
|
||||
def test_raw_pipe_input_disables_redundant_ffmpeg_probing(
|
||||
@pytest.mark.parametrize("suffix", [".mp4", ".webm"])
|
||||
def test_encoder_bounds_codec_threads(
|
||||
self,
|
||||
tmp_path: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
suffix: str,
|
||||
):
|
||||
from remove_ai_watermarks import video_encoding
|
||||
|
||||
monkeypatch.setattr(video_encoding.shutil, "which", lambda _name: "/usr/bin/ffmpeg")
|
||||
command = video_encoding.raw_video_command(
|
||||
tmp_path / "source.mp4",
|
||||
tmp_path / "clean.mp4",
|
||||
tmp_path / f"clean{suffix}",
|
||||
width=12,
|
||||
height=8,
|
||||
fps=24.0,
|
||||
@@ -1969,14 +1971,7 @@ class TestVideoVisibleEncoding:
|
||||
profile=video_encoding.VideoEncodeProfile(),
|
||||
)
|
||||
|
||||
pipe_position = command.index("pipe:0")
|
||||
assert command[pipe_position - 5 : pipe_position] == [
|
||||
"-analyzeduration",
|
||||
"0",
|
||||
"-probesize",
|
||||
"32",
|
||||
"-i",
|
||||
]
|
||||
assert command[command.index("-threads:v") + 1] == "2"
|
||||
|
||||
@staticmethod
|
||||
def _patch_single_frame_encode(
|
||||
|
||||
@@ -102,13 +102,9 @@ def test_timestamped_encoder_reads_nut_and_passes_pts_through(
|
||||
)
|
||||
|
||||
assert "-copyts" in command
|
||||
assert command[command.index("-f") : command.index("-f") + 8] == [
|
||||
assert command[command.index("-f") : command.index("-f") + 4] == [
|
||||
"-f",
|
||||
"nut",
|
||||
"-analyzeduration",
|
||||
"0",
|
||||
"-probesize",
|
||||
"32",
|
||||
"-i",
|
||||
"pipe:0",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user