mirror of
https://github.com/wiltodelta/remove-ai-watermarks.git
synced 2026-08-10 08:00:32 +02:00
Prevent ffmpeg pipe probe deadlock
This commit is contained in:
@@ -1950,6 +1950,34 @@ class TestVideoVisibleScan:
|
||||
|
||||
|
||||
class TestVideoVisibleEncoding:
|
||||
def test_raw_pipe_input_disables_redundant_ffmpeg_probing(
|
||||
self,
|
||||
tmp_path: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
):
|
||||
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",
|
||||
width=12,
|
||||
height=8,
|
||||
fps=24.0,
|
||||
strip_metadata=True,
|
||||
crf=14,
|
||||
profile=video_encoding.VideoEncodeProfile(),
|
||||
)
|
||||
|
||||
pipe_position = command.index("pipe:0")
|
||||
assert command[pipe_position - 5 : pipe_position] == [
|
||||
"-analyzeduration",
|
||||
"0",
|
||||
"-probesize",
|
||||
"32",
|
||||
"-i",
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def _patch_single_frame_encode(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
|
||||
@@ -102,7 +102,16 @@ def test_timestamped_encoder_reads_nut_and_passes_pts_through(
|
||||
)
|
||||
|
||||
assert "-copyts" in command
|
||||
assert command[command.index("-f") : command.index("-f") + 4] == ["-f", "nut", "-i", "pipe:0"]
|
||||
assert command[command.index("-f") : command.index("-f") + 8] == [
|
||||
"-f",
|
||||
"nut",
|
||||
"-analyzeduration",
|
||||
"0",
|
||||
"-probesize",
|
||||
"32",
|
||||
"-i",
|
||||
"pipe:0",
|
||||
]
|
||||
assert command[command.index("-fps_mode") + 1] == "passthrough"
|
||||
assert command[command.index("-avoid_negative_ts") + 1] == "disabled"
|
||||
assert command[command.index("-enc_time_base:v") + 1] == "1/90000"
|
||||
|
||||
Reference in New Issue
Block a user