Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

ci(tests): run Windows tests on Blacksmith, ffmpeg tests on GitHub (#9951)

Lincoln Stein0f9c545bebfe
diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml
index e6fcdecf46..b7bbb84a9e 100644
--- a/.github/workflows/python-tests.yml
+++ b/.github/workflows/python-tests.yml
@@ -54,6 +54,7 @@ jobs:
- linux-cpu
- macos-default
- windows-cpu
+ - windows-ffmpeg
- windows-arm64
include:
- platform: linux-cpu
@@ -68,20 +69,30 @@ jobs:
pytest-workers: logical
timeout-minutes: 30
- platform: windows-cpu
- os: windows-2022
+ os: blacksmith-8vcpu-windows-2025
github-env: $env:GITHUB_ENV
- # Half the vCPUs, not one worker each. The tests that spawn helper processes --
- # ffmpeg decoders, installer subprocesses -- bring their own threads, which the
- # per-worker `OMP_NUM_THREADS=1` below does not cap, so a full-width run leaves this
- # runner with no spare core and the deadline-sensitive tests miss their budgets
- # non-deterministically. Two workers keep that headroom.
- pytest-workers: '2'
+ pytest-workers: logical
+ # This runner is Windows Server 2025 Core, which lacks the Video for Windows DLLs
+ # (AVICAP32, MSVFW32) every standard Windows ffmpeg build links against, so ffmpeg
+ # cannot start here. The `ffmpeg` tests run in windows-ffmpeg instead.
# Windows installs linux's dependency set, so a `platform_independent` test cannot fail differently
# here than on linux, which runs it. macOS runs a different torch without bitsandbytes and keeps them.
- pytest-markers: 'not slow and not platform_independent'
- # Roughly 1.5x the pytest step's four-worker wall time (~13.5 min), plus the job's
- # ~1.5 min of checkout and install, plus margin.
- timeout-minutes: 45
+ pytest-markers: 'not slow and not platform_independent and not ffmpeg'
+ prepare-server-core: true
+ # Roughly 3x the job's ~5 min (pytest ~3 min, checkout, install and runner preparation ~2 min).
+ timeout-minutes: 15
+ - platform: windows-ffmpeg
+ os: windows-2022
+ github-env: $env:GITHUB_ENV
+ # Half the vCPUs, not one worker each. The ffmpeg tests spawn decoders and encoders that
+ # bring their own threads, which the per-worker `OMP_NUM_THREADS=1` below does not cap,
+ # so a full-width run leaves this runner with no spare core and the deadline-sensitive
+ # tests miss their budgets non-deterministically. Two workers keep that headroom.
+ pytest-workers: '2'
+ pytest-markers: 'not slow and not platform_independent and ffmpeg'
+ # Roughly 1.5x the pytest step's two-worker wall time (~6 min), plus the job's ~1 min
+ # of checkout and install, plus margin.
+ timeout-minutes: 15
# Windows on ARM64 (NVIDIA RTX Spark). The lockfile's ARM64 fork is exercised nowhere else:
# torch 2.14.0+cu134 from NVIDIA's index (a 1.85 GB wheel, CPU-only on this runner), numpy 2,
# onnxruntime 1.31, sentencepiece 0.2.2 and the self-built opencv/blake3/tiktoken wheels. uv
@@ -90,7 +101,7 @@ jobs:
os: windows-11-arm
uv-python: cpython-3.12-windows-aarch64-none
github-env: $env:GITHUB_ENV
- # Two workers for the same reason as windows-cpu. The job also downloads the NVIDIA torch
+ # Two workers for the same reason as windows-ffmpeg. The job also downloads the NVIDIA torch
# wheel and builds imageio-ffmpeg from its sdist (~18 min at four workers).
pytest-workers: '2'
# A per-test timeout turns a hang into a failure with a traceback, so pytest still reaches its summary
@@ -100,8 +111,7 @@ jobs:
timeout-minutes: 60
name: 'py${{ matrix.python-version }}: ${{ matrix.platform }}'
runs-on: ${{ matrix.os }}
- # Per platform: expected run time is 8-14 min on linux and macos, longer on windows, which
- # runs fewer workers. See the matrix.
+ # Per platform: expected run time is 8-14 min on linux and macos. See the matrix for windows.
timeout-minutes: ${{ matrix.timeout-minutes }}
env:
PIP_USE_PEP517: '1'
@@ -186,6 +196,22 @@ jobs:
UV_INDEX: ${{ matrix.extra-index-url }}
run: uv sync --no-progress --locked --extra test
+ # Windows Server Core lacks two things the suite imports. The non-headless opencv build needs
+ # Media Foundation at `import cv2`; the feature installs in ~30 s without a reboot. There is
+ # no audio stack either, so `import sounddevice` raises PortAudioError, which mediapipe does
+ # not catch (only ImportError/OSError). Removing the module turns that into the ImportError
+ # mediapipe falls back on. No test needs a real audio device.
+ - name: prepare server core
+ if: ${{ matrix.prepare-server-core && (steps.changed-files.outputs.python_any_changed == 'true' || inputs.always_run == true) }}
+ run: |
+ $result = Install-WindowsFeature -Name Server-Media-Foundation
+ Write-Output "Success: $($result.Success) RestartNeeded: $($result.RestartNeeded)"
+ $result.FeatureResult | Format-Table -AutoSize | Out-String | Write-Output
+ if (-not $result.Success) { throw 'Installing Server-Media-Foundation failed' }
+ Remove-Item .venv\Lib\site-packages\sounddevice.py
+ uv run --no-sync python -c "import cv2, mediapipe; print(cv2.__version__, mediapipe.__version__)"
+ if ($LASTEXITCODE -ne 0) { throw 'cv2 or mediapipe still fails to import after preparing the runner' }
+
- name: import the self-built and platform-specific wheels
if: ${{ matrix.platform == 'windows-arm64' && (steps.changed-files.outputs.python_any_changed == 'true' || inputs.always_run == true) }}
# The suite never imports tiktoken, so a broken self-built wheel would otherwise pass unnoticed.
@@ -196,7 +222,7 @@ jobs:
# `logical`, not `auto`: xdist's `auto` asks psutil for *physical* cores, which is half
# the vCPUs a standard runner exposes. Much of the suite waits on timers and polls, so
# one worker per vCPU is the right level where the runner has the headroom for it. The
- # matrix carries the count, because windows needs a lower one.
+ # matrix carries the count, because windows-ffmpeg and windows-arm64 need a lower one.
run: uv run --no-sync pytest -n ${{ matrix.pytest-workers }} --max-worker-restart=0 -m "${{ matrix.pytest-markers || 'not slow' }}" ${{ matrix.pytest-args }}
# Decides whether the external-database job runs. That job's service containers start before any of its
diff --git a/pyproject.toml b/pyproject.toml
index 20912e1a3f..605be35a97 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -655,6 +655,7 @@ markers = [
"uses_database: Runs on the `empty_database` fixture, which targets INVOKEAI_TEST_DB_URL when it is set and SQLite otherwise. Applied by the collection hook in tests/conftest.py.",
"sqlite_only: Depends on SQLite internals (query plans, PRAGMAs, the single connection); skipped when INVOKEAI_TEST_DB_URL targets another backend.",
"platform_independent: The outcome cannot depend on the operating system for the same dependency set: import-graph boundaries in a fresh interpreter, static source scans, deterministic counts and shapes. Windows CI, which installs the linux dependency set, deselects them.",
+ "ffmpeg: Runs an ffmpeg binary or loads the libav libraries. The windows-cpu CI job, whose Server Core runner cannot load them, deselects them; windows-ffmpeg runs only these.",
]
# A cache-key or other SQLAlchemy warning is a bug in the query layer, not noise.
filterwarnings = ["error::sqlalchemy.exc.SAWarning"]
diff --git a/tests/AGENTS.md b/tests/AGENTS.md
index cc89658050..ec4a0604be 100644
--- a/tests/AGENTS.md
+++ b/tests/AGENTS.md
@@ -5,13 +5,14 @@
- Name tests by outcome. Cover meaningful edge and failure cases. Survive behavior-preserving refactors. Prefer real temporary SQLite/filesystem/tensor operations. Mock external services, expensive models, unavailable hardware; never mock the transaction, authorization, concurrency, or numerical behavior under test.
- Isolate paths, databases, accounts, clocks, seeds, environment, network behavior. Clean up subprocesses, listeners, patches, resources. Never use production model/database/output directories.
- Cover affected rollback, revisions, cross-user isolation, retries, cancellation, bounds, cleanup. IndexedDB, Web Locks, focus, rendering belong in webv2 browser tests.
-- Use root pytest commands. CI runs one xdist worker per vCPU; windows runs fewer. `--dist loadfile` in `addopts` keeps each file on one worker; file assignment and order are arbitrary. Each file sets up its own process-global state (e.g. JWT secret) and passes alone. Verify new files on their own.
+- Use root pytest commands. CI runs one xdist worker per vCPU; windows-ffmpeg runs two. `--dist loadfile` in `addopts` keeps each file on one worker; file assignment and order are arbitrary. Each file sets up its own process-global state (e.g. JWT secret) and passes alone. Verify new files on their own.
- Default tests assert behavior, not throughput or latency under runner contention. Generous hang ceilings fine. CPU time tolerates contention better than wall time. Hardware/quiet-machine measurements need `slow`, excluded by default and in CI. Dev machines: `-m slow` for that lane, `-m ""` for everything.
-- Keep a test's run time to the work it checks; windows runs the suite on two workers, so idle seconds there set the CI wall clock. Check new files with `--durations=10`, which splits setup, call and teardown.
+- Keep a test's run time to the work it checks; idle seconds add up across the suite, and the ffmpeg tests run on two workers in windows-ffmpeg. Check new files with `--durations=10`, which splits setup, call and teardown.
- No real waits. Poll intervals, retry backoffs and grace periods belong in module-level constants that a fixture can shorten. The root `conftest.py` already shortens the download, installer and image-index queue polls, so a service's `stop()` in teardown returns at once. Shorten a retry backoff only in the tests that script its failures, as `_fake_move` in `test_model_install.py` does: the backoff is what lets a real Windows file handle close.
- Passwords hash at bcrypt cost 4 in tests. Request `production_password_hashing` to assert or measure the production cost.
- A fresh interpreter costs about ten seconds of imports. Spawn one only when isolation is the point (import order, `sys.modules`, process-global state), and check many cases inside one subprocess unless each case needs its own cold start.
- A full `gc.collect()` walks the worker's whole heap, a third of a second late in a session. Tests that collect repeatedly freeze the pre-existing heap first, as `test_model_cache_ram_budget.py` does.
- Mark a test `platform_independent` only when no operating system can change its outcome for the same dependency set: import-graph boundaries in a fresh interpreter, static source scans, deterministic counts or shapes. Windows CI, which installs the linux dependency set, deselects them; macOS runs a different torch and keeps them. Numerics (BLAS kernels differ per platform), process-spawning behavior (start methods, helper executables), filesystem paths and locking, and dependency smoke tests stay unmarked.
+- Mark a test `ffmpeg` when it runs an ffmpeg binary or loads the libav libraries, directly or through fixtures and helpers, including tests that feed ffmpeg bad input to check its rejection. Not when ffmpeg is mocked, or only spawned incidentally on input every decoder rejects. The windows-cpu runner is Windows Server Core, whose missing video DLLs stop every standard ffmpeg build from loading, so it deselects them; windows-ffmpeg runs only them on a hosted runner. Module-level `pytestmark` when the whole file needs it. To find unmarked ones, reproduce that runner: unset `IMAGEIO_FFMPEG_EXE`, rename the binary under `imageio_ffmpeg/binaries/` in the venv so `get_ffmpeg_exe()` raises (with no ffmpeg on `PATH`), set `OPENCV_VIDEOIO_PRIORITY_FFMPEG=0`, and run `-m "not slow and not ffmpeg"`. Pointing `IMAGEIO_FFMPEG_EXE` at a failing program is not enough: imageio-ffmpeg returns that path untested.
- State hardware prerequisites and skipped/unavailable devices. CPU or mocked passes do not prove CUDA/ROCm/MPS/XPU behavior.
- No CPU bf16 matmul unless low precision is the behavior under test. Why: torch's CPU bf16 GEMM faults with an illegal instruction (`0xc000001d`) on part of the hosted windows fleet; that aborts the worker and fails the job. Run the forward at float32 and assert the width separately, as the nvfp4 loader tests do. Skip on win32 only when bf16 itself is the subject.
diff --git a/tests/app/invocations/test_ltx2_nodes.py b/tests/app/invocations/test_ltx2_nodes.py
index 1f56f75f21..facde32b9c 100644
--- a/tests/app/invocations/test_ltx2_nodes.py
+++ b/tests/app/invocations/test_ltx2_nodes.py
@@ -262,6 +262,7 @@ def test_fitting_an_image_to_the_canvas_crops_rather_than_stretches() -> None:
assert fitted.getpixel((352, 352)) == (0, 0, 255)
def test_the_crf_round_trip_returns_a_recompressed_frame_of_the_same_size() -> None:
"""The conditioning image has to carry codec artefacts; the round trip goes through ffmpeg,
whose two-process pipe is easy to get subtly wrong."""
@@ -276,6 +277,7 @@ def test_the_crf_round_trip_returns_a_recompressed_frame_of_the_same_size() -> N
assert recompress_h264(source, 0) is source
def test_an_odd_sized_image_is_cropped_to_what_h264_can_encode() -> None:
source = Image.new("RGB", (65, 33), "green")
assert recompress_h264(source, 18).size == (64, 32)
@@ -1352,6 +1354,7 @@ def test_the_source_clip_is_streamed_rather_than_collected(monkeypatch: pytest.M
assert decoded == 2
def test_the_held_latents_are_not_decoded_when_the_source_clip_is_wired(monkeypatch: pytest.MonkeyPatch) -> None:
"""The whole point is to skip that work: decoding is a second tiled VAE pass over a clip whose
pixels are already on disk."""
diff --git a/tests/app/invocations/test_video_concat_audio.py b/tests/app/invocations/test_video_concat_audio.py
index e3b59c5d37..7f32defac8 100644
--- a/tests/app/invocations/test_video_concat_audio.py
+++ b/tests/app/invocations/test_video_concat_audio.py
@@ -71,6 +71,7 @@ def _invocation(n_videos: int = 2, transition: str = "cut", transition_frames: i
)
class TestExtraction:
def test_roundtrip_tone(self, tmp_path):
clip = _make_clip(tmp_path, "a", 32, freq=440.0)
@@ -99,6 +100,7 @@ class TestResample:
resample_linear(np.zeros(10, dtype=np.float32), 5)
class TestBuildAudioTrack:
def _build(self, paths, frame_counts, invocation=None, output_fps=FPS, native=None, durations=None):
inv = invocation or _invocation(n_videos=len(paths))
@@ -256,6 +258,7 @@ class TestBuildAudioTrack:
assert abs(_dominant_freq(pcm[:, half + RATE // 4 :], rate) - 880.0) < 15.0
class TestMux:
def test_end_to_end_cut_produces_audible_mp4(self, tmp_path):
"""The full pipeline the node runs: silent video encode -> audio build -> mux."""
diff --git a/tests/app/invocations/test_video_concat_splice.py b/tests/app/invocations/test_video_concat_splice.py
index 7d8876aac4..f8dc74ff62 100644
--- a/tests/app/invocations/test_video_concat_splice.py
+++ b/tests/app/invocations/test_video_concat_splice.py
@@ -33,6 +33,8 @@ from invokeai.app.util.video_encoding import (
)
from invokeai.app.util.video_thumbnails import probe_video
+pytestmark = pytest.mark.ffmpeg
+
FPS = 16.0
WIDTH, HEIGHT = 128, 96
RATE = 32000
diff --git a/tests/app/invocations/test_video_frame_extract.py b/tests/app/invocations/test_video_frame_extract.py
index 6bd22ca247..35dcff0d01 100644
--- a/tests/app/invocations/test_video_frame_extract.py
+++ b/tests/app/invocations/test_video_frame_extract.py
@@ -26,6 +26,7 @@ def _write_mp4(tmp_path, n_frames: int):
return path
class TestDecoderFrameCountExact:
"""decoder_frame_count returns the actual decoded count from the container."""
@@ -43,6 +44,7 @@ class TestDecoderFrameCountGracefulFallback:
# Either iio raises (caught) or returns props without shape — both must yield None.
assert decoder_frame_count(bogus) is None
+ @pytest.mark.ffmpeg
def test_non_video_file_returns_none(self, tmp_path) -> None:
not_a_video = tmp_path / "junk.mp4"
not_a_video.write_bytes(b"not actually an mp4")
diff --git a/tests/app/invocations/test_video_frame_extract_range.py b/tests/app/invocations/test_video_frame_extract_range.py
index 6bec7b32fa..5a31a366e2 100644
--- a/tests/app/invocations/test_video_frame_extract_range.py
+++ b/tests/app/invocations/test_video_frame_extract_range.py
@@ -174,6 +174,7 @@ def _decode(path: Path) -> list[np.ndarray]:
reader.close()
@pytest.mark.parametrize("fps", [0, 16])
def test_whole_clip_at_its_own_rate_is_copied_without_re_encoding(tmp_path: Path, fps: int) -> None:
"""Extend Video passes an untrimmed source through this node on every extension; a
@@ -244,6 +245,7 @@ def _invoke_trim(tmp_path: Path, source: Path, start: int, end: int) -> tuple[Pa
return saved, context
@pytest.mark.parametrize("start,end", [(0, 80), (10, 80), (10, 99), (32, 63)])
def test_trim_copies_the_keyframe_aligned_frames_inside_the_range(tmp_path: Path, start: int, end: int) -> None:
"""Trimming the source before extending it must not re-encode the frames that survive
@@ -270,6 +272,7 @@ def test_trim_copies_the_keyframe_aligned_frames_inside_the_range(tmp_path: Path
assert context.videos.save.call_args.kwargs["duration"] == pytest.approx((end - start + 1) / 16.0)
def test_trim_within_one_keyframe_interval_is_re_encoded(tmp_path: Path) -> None:
source = tmp_path / "source.mp4"
_textured_source(source, 100)
@@ -278,6 +281,7 @@ def test_trim_within_one_keyframe_interval_is_re_encoded(tmp_path: Path) -> None
assert "Stream-copied" not in str(context.logger.info.call_args_list)
def test_whole_clip_copy_does_not_carry_the_sources_generation_metadata(tmp_path: Path) -> None:
"""save() rewrites the record into the file, but falls back to a sidecar if that fails,
and embedded tags win on read: a copy still carrying the source's would be read back
@@ -293,6 +297,7 @@ def test_whole_clip_copy_does_not_carry_the_sources_generation_metadata(tmp_path
assert len(_decode(saved)) == 24
@pytest.mark.parametrize("start,end", [(31, 66), (30, 63), (32, 64), (32, 65), (31, 64), (63, 65)])
def test_short_encoded_ends_keep_one_timeline(tmp_path: Path, start: int, end: int) -> None:
"""x264 encodes a 1-2 frame part with a shorter B-frame delay than a full one, and joining
@@ -309,6 +314,7 @@ def test_short_encoded_ends_keep_one_timeline(tmp_path: Path, start: int, end: i
assert len(_decode(saved)) == n
def test_open_gop_source_trim_keeps_every_frame(tmp_path: Path) -> None:
"""An open-GOP I-frame is a sync sample but not a clean cut: the frames after it in
decode order that display before it would be lost from a copied run."""
@@ -347,6 +353,7 @@ def test_open_gop_source_trim_keeps_every_frame(tmp_path: Path) -> None:
assert len(_decode(saved)) == 100 - start, f"trim from {start}"
@pytest.mark.parametrize("start,end", [(31, 130), (40, 129)])
def test_cut_moves_inward_rather_than_leave_a_short_encoded_end(tmp_path: Path, start: int, end: int) -> None:
source = tmp_path / "source.mp4"
@@ -358,6 +365,7 @@ def test_cut_moves_inward_rather_than_leave_a_short_encoded_end(tmp_path: Path,
assert len(_decode(saved)) == end - start + 1
def test_squeezed_join_falls_back_to_re_encoding(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
"""The joined file's timeline is checked, not assumed: with the short-end rule disabled,
a 1-frame encoded head squeezes the timestamps and the node must re-encode instead."""
@@ -371,6 +379,7 @@ def test_squeezed_join_falls_back_to_re_encoding(tmp_path: Path, monkeypatch: py
assert len(_decode(saved)) == 65
def test_cancellation_during_a_trim_splice_saves_nothing(tmp_path: Path) -> None:
source = tmp_path / "source.mp4"
_textured_source(source, 200)
diff --git a/tests/app/invocations/test_video_frame_extract_range_audio.py b/tests/app/invocations/test_video_frame_extract_range_audio.py
index fe754366da..f703d32e0f 100644
--- a/tests/app/invocations/test_video_frame_extract_range_audio.py
+++ b/tests/app/invocations/test_video_frame_extract_range_audio.py
@@ -15,6 +15,7 @@ from pathlib import Path
from unittest.mock import MagicMock, patch
import numpy as np
+import pytest
from invokeai.app.invocations.fields import VideoField
from invokeai.app.invocations.video_frame_extract_range import ExtractVideoRangeInvocation
@@ -89,6 +90,7 @@ def _invoke_and_capture(invocation: ExtractVideoRangeInvocation, clip_path: Path
return saved
class TestRangeAudio:
def test_trim_keeps_the_matching_audio_slice(self, tmp_path):
# 2 s clip: first second 440 Hz, second second 880 Hz. Trimming the back half
diff --git a/tests/app/invocations/test_video_frame_extract_range_audio_splice.py b/tests/app/invocations/test_video_frame_extract_range_audio_splice.py
index 7448b7e912..41ea4a19dc 100644
--- a/tests/app/invocations/test_video_frame_extract_range_audio_splice.py
+++ b/tests/app/invocations/test_video_frame_extract_range_audio_splice.py
@@ -31,6 +31,8 @@ from invokeai.app.util.mp4_metadata import find_box, write_mp4_tags
from invokeai.app.util.video_audio import extract_audio_pcm
from invokeai.app.util.video_encoding import make_mp4_writer, write_stereo_wav
+pytestmark = pytest.mark.ffmpeg
+
FPS = 16.0
RATE = 32000
SIZE = 64
diff --git a/tests/app/routers/test_videos_multiuser.py b/tests/app/routers/test_videos_multiuser.py
index 9f8f0e16b4..80bad22a76 100644
--- a/tests/app/routers/test_videos_multiuser.py
+++ b/tests/app/routers/test_videos_multiuser.py
@@ -588,6 +588,7 @@ def test_video_star_endpoints_dedupe_names_and_report_partial_failures(
# ---------------------------------------------------------------------------
def test_upload_video_malformed_mp4_returns_415_and_cleans_up_tmp(
client: TestClient, mock_invoker: Invoker, user1_token: str, tmp_path: Path
):
@@ -643,6 +644,7 @@ def test_upload_video_malformed_mp4_returns_415_and_cleans_up_tmp(
assert not leaked, f"tmp files leaked after 415: {leaked}"
def test_upload_video_rejects_non_mp4_container_with_spoofed_mime(
client: TestClient, mock_invoker: Invoker, user1_token: str
):
@@ -738,6 +740,7 @@ def _make_fixture_media(path: Path, *args: str) -> Path:
return path
def test_upload_h264_mov_is_remuxed_and_created(
client: TestClient, mock_invoker: Invoker, user1_token: str, tmp_path: Path
):
@@ -773,6 +776,7 @@ def test_upload_h264_mov_is_remuxed_and_created(
assert stored_was_mp4 == [True]
def test_upload_audio_file_is_wrapped_and_marked(
client: TestClient, mock_invoker: Invoker, user1_token: str, tmp_path: Path
):
@@ -801,6 +805,7 @@ def test_upload_audio_file_is_wrapped_and_marked(
assert (create_kwargs["width"], create_kwargs["height"]) == (640, 360)
def test_upload_mp4_with_non_aac_audio_gets_audio_normalized(
client: TestClient, mock_invoker: Invoker, user1_token: str, tmp_path: Path
):
@@ -1299,6 +1304,7 @@ def _upload(client: TestClient, token: str, body: bytes, metadata: str | None =
)
def test_upload_video_recovers_metadata_workflow_and_graph_embedded_in_the_file(
client: TestClient, mock_invoker: Invoker, user1_token: str, tmp_path: Path
):
@@ -1333,6 +1339,7 @@ def test_upload_video_recovers_metadata_workflow_and_graph_embedded_in_the_file(
assert kwargs["graph"] == tags["invokeai_graph"]
def test_upload_video_client_metadata_wins_over_the_embedded_copy(
client: TestClient, mock_invoker: Invoker, user1_token: str, tmp_path: Path
):
@@ -1361,6 +1368,7 @@ def test_upload_video_without_embedded_tags_stores_no_metadata(
assert (kwargs["metadata"], kwargs["workflow"], kwargs["graph"]) == (None, None, None)
def test_upload_recovers_embedded_tags_from_a_file_the_ingest_path_rewrites(
client: TestClient, mock_invoker: Invoker, user1_token: str, tmp_path: Path
):
@@ -1403,6 +1411,7 @@ def test_upload_recovers_embedded_tags_from_a_file_the_ingest_path_rewrites(
assert stored_tags == [{}]
def test_upload_ignores_an_embedded_metadata_record_over_the_form_field_cap(
client: TestClient, mock_invoker: Invoker, user1_token: str, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
):
diff --git a/tests/app/services/video_files/test_video_files_disk.py b/tests/app/services/video_files/test_video_files_disk.py
index 8f4afdb98f..414b5406d7 100644
--- a/tests/app/services/video_files/test_video_files_disk.py
+++ b/tests/app/services/video_files/test_video_files_disk.py
@@ -264,6 +264,7 @@ def _sidecars(storage: DiskVideoFileStorage) -> list[Path]:
return [p for p in _all_files(storage.get_path(VIDEO_NAME).parent) if p.suffix == ".json"]
def test_save_embeds_metadata_workflow_and_graph_in_the_mp4_and_writes_no_sidecar(
storage: DiskVideoFileStorage, real_source: Path
):
@@ -290,6 +291,7 @@ def test_save_embeds_metadata_workflow_and_graph_in_the_mp4_and_writes_no_sideca
assert storage.get_path(VIDEO_NAME, thumbnail=True).exists()
def test_save_without_any_metadata_leaves_the_file_byte_identical(storage: DiskVideoFileStorage, real_source: Path):
original = real_source.read_bytes()
@@ -299,6 +301,7 @@ def test_save_without_any_metadata_leaves_the_file_byte_identical(storage: DiskV
assert _sidecars(storage) == []
def test_save_falls_back_to_a_sidecar_when_embedding_fails(
storage: DiskVideoFileStorage, real_source: Path, monkeypatch: pytest.MonkeyPatch
):
@@ -321,6 +324,7 @@ def test_save_falls_back_to_a_sidecar_when_embedding_fails(
assert [p.name for p in _all_files(storage.get_path(VIDEO_NAME).parent) if p.name.startswith(".embed_")] == []
def test_legacy_sidecar_is_still_read_for_an_untagged_video(storage: DiskVideoFileStorage, real_source: Path):
storage.save(source_path=real_source, video_name=VIDEO_NAME)
sidecar_dir = storage.get_path(VIDEO_NAME).parent / "sidecars"
@@ -333,6 +337,7 @@ def test_legacy_sidecar_is_still_read_for_an_untagged_video(storage: DiskVideoFi
assert storage.get_graph(VIDEO_NAME) is None
def test_embedded_tags_win_over_a_stale_sidecar(storage: DiskVideoFileStorage, real_source: Path):
storage.save(source_path=real_source, video_name=VIDEO_NAME, workflow='{"name": "embedded"}')
sidecar_dir = storage.get_path(VIDEO_NAME).parent / "sidecars"
@@ -342,6 +347,7 @@ def test_embedded_tags_win_over_a_stale_sidecar(storage: DiskVideoFileStorage, r
assert storage.get_workflow(VIDEO_NAME) == '{"name": "embedded"}'
def test_save_of_an_already_tagged_file_skips_the_rewrite(
storage: DiskVideoFileStorage, real_source: Path, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
):
@@ -366,6 +372,7 @@ def test_save_of_an_already_tagged_file_skips_the_rewrite(
assert _sidecars(storage) == []
def test_crlf_metadata_is_embedded_not_rejected(storage: DiskVideoFileStorage, real_source: Path):
"""CRLF-formatted JSON from an API client must neither fail the save nor lose the record."""
from invokeai.app.util.mp4_metadata import read_mp4_tags
@@ -378,6 +385,7 @@ def test_crlf_metadata_is_embedded_not_rejected(storage: DiskVideoFileStorage, r
assert _sidecars(storage) == []
def test_a_tag_the_writer_refuses_falls_back_to_a_sidecar_without_leaking(
storage: DiskVideoFileStorage, real_source: Path
):
@@ -401,6 +409,7 @@ def test_start_sweeps_remux_temp_files_left_by_a_crash(tmp_path: Path):
assert not stale.exists()
def test_a_file_carrying_a_tag_the_caller_dropped_is_rewritten_without_it(
storage: DiskVideoFileStorage, real_source: Path, tmp_path: Path
):
@@ -424,6 +433,7 @@ def test_a_file_carrying_a_tag_the_caller_dropped_is_rewritten_without_it(
assert storage.get_graph(VIDEO_NAME) == "{}"
def test_a_file_whose_only_tag_was_rejected_is_stored_without_it(
storage: DiskVideoFileStorage, real_source: Path, tmp_path: Path
):
diff --git a/tests/app/test_extract_metadata.py b/tests/app/test_extract_metadata.py
index 6ff6eed3b5..682cc22b1a 100644
--- a/tests/app/test_extract_metadata.py
+++ b/tests/app/test_extract_metadata.py
@@ -268,6 +268,7 @@ MINIMAL_WORKFLOW = {
}
def test_extract_from_tagged_video_returns_the_embedded_strings(mock_logger, tagged_mp4):
"""Through the real workflow validator: the video entry point is not mocked."""
from invokeai.app.api.extract_metadata import extract_metadata_from_video
@@ -282,6 +283,7 @@ def test_extract_from_tagged_video_returns_the_embedded_strings(mock_logger, tag
)
def test_extract_from_video_prefers_the_client_metadata_over_the_embedded_copy(mock_logger, tagged_mp4):
from invokeai.app.api.extract_metadata import extract_metadata_from_video
@@ -295,6 +297,7 @@ def test_extract_from_video_prefers_the_client_metadata_over_the_embedded_copy(m
assert result.invokeai_graph == tags["invokeai_graph"]
def test_extract_from_untagged_or_non_mp4_video_is_all_none(mock_logger, tagged_mp4, tmp_path):
from invokeai.app.api.extract_metadata import extract_metadata_from_video
diff --git a/tests/app/util/test_h264_splice.py b/tests/app/util/test_h264_splice.py
index 705422ad62..bc5488b4de 100644
--- a/tests/app/util/test_h264_splice.py
+++ b/tests/app/util/test_h264_splice.py
@@ -28,6 +28,8 @@ from invokeai.app.util.aac_splice import read_aac_layout
from invokeai.app.util.h264_splice import read_h264_layout, run_ffmpeg
from invokeai.app.util.video_encoding import make_mp4_writer, write_stereo_wav, writer_sample_entry
+pytestmark = pytest.mark.ffmpeg
+
FPS = 16.0
diff --git a/tests/app/util/test_mp4_metadata.py b/tests/app/util/test_mp4_metadata.py
index 62ad714a8f..c77c572291 100644
--- a/tests/app/util/test_mp4_metadata.py
+++ b/tests/app/util/test_mp4_metadata.py
@@ -56,6 +56,7 @@ def _fake_mp4(path: Path, udta: bytes, *, moov_first: bool = True) -> Path:
return path
def test_round_trip_through_ffmpeg_preserves_every_special_character(tiny_mp4: Path, tmp_path: Path) -> None:
metadata = json.dumps({"positive_prompt": "a=b;c#d\\e\nf", "seed": 7, "nested": {"k": [1, 2]}})
graph = json.dumps({"nodes": {}, "edges": []})
@@ -77,6 +78,7 @@ def test_round_trip_through_ffmpeg_preserves_every_special_character(tiny_mp4: P
assert b"moov" in head
def test_round_trip_of_a_payload_larger_than_a_megabyte(tiny_mp4: Path, tmp_path: Path) -> None:
graph = json.dumps({"nodes": {"x": "y" * 1_500_000}, "edges": []})
out = tmp_path / "big.mp4"
@@ -86,6 +88,7 @@ def test_round_trip_of_a_payload_larger_than_a_megabyte(tiny_mp4: Path, tmp_path
assert read_mp4_tags(out, keys=["invokeai_graph"]) == {"invokeai_graph": graph}
def test_keys_filter_returns_only_the_requested_tags(tiny_mp4: Path, tmp_path: Path) -> None:
out = tmp_path / "filtered.mp4"
write_mp4_tags(tiny_mp4, out, {"invokeai_metadata": "{}", "invokeai_workflow": "{}"})
@@ -94,6 +97,7 @@ def test_keys_filter_returns_only_the_requested_tags(tiny_mp4: Path, tmp_path: P
assert read_mp4_tags(out, keys=["absent"]) == {}
def test_untagged_mp4_and_non_mp4_read_as_no_tags(tiny_mp4: Path, tmp_path: Path) -> None:
assert read_mp4_tags(tiny_mp4) == {}
garbage = tmp_path / "garbage.mp4"
@@ -143,6 +147,7 @@ def test_non_utf8_data_atom_is_skipped(tmp_path: Path) -> None:
assert read_mp4_tags(path) == {}
def test_carriage_returns_round_trip(tiny_mp4: Path, tmp_path: Path) -> None:
# CRLF-formatted JSON from an API client reaches the writer verbatim.
value = '{\r\n "seed": 1\r\n}'
@@ -156,6 +161,7 @@ def test_carriage_returns_round_trip(tiny_mp4: Path, tmp_path: Path) -> None:
}
def test_an_empty_mapping_strips_existing_tags(tiny_mp4: Path, tmp_path: Path) -> None:
tagged = tmp_path / "tagged.mp4"
write_mp4_tags(tiny_mp4, tagged, {"invokeai_workflow": "{}"})
@@ -165,6 +171,7 @@ def test_an_empty_mapping_strips_existing_tags(tiny_mp4: Path, tmp_path: Path) -
assert read_mp4_tags(tmp_path / "stripped.mp4", keys=["invokeai_workflow"]) == {}
def test_write_rejects_tags_the_ffmetadata_grammar_cannot_carry(tiny_mp4: Path, tmp_path: Path) -> None:
# ffmpeg reads a backslash before the line break as a continuation even when escaped, so a
# value ending in one would swallow the following tag.
@@ -192,6 +199,7 @@ def test_top_level_walk_is_bounded(tmp_path: Path, monkeypatch: pytest.MonkeyPat
assert read_mp4_tags(path) == {}
def test_write_raises_on_an_undecodable_source(tmp_path: Path) -> None:
garbage = tmp_path / "garbage.mp4"
garbage.write_bytes(b"\x00\x00\x00\x18ftypmp42 not a real mp4")
@@ -200,6 +208,7 @@ def test_write_raises_on_an_undecodable_source(tmp_path: Path) -> None:
write_mp4_tags(garbage, tmp_path / "out.mp4", {"invokeai_metadata": "{}"})
def test_read_ftyp_major_brand(tiny_mp4: Path, tmp_path: Path) -> None:
assert read_ftyp_major_brand(tiny_mp4) == b"isom"
qt = tmp_path / "qt.mov"
diff --git a/tests/app/util/test_video_audio_float.py b/tests/app/util/test_video_audio_float.py
index 044ce7d693..d98ad51ee3 100644
--- a/tests/app/util/test_video_audio_float.py
+++ b/tests/app/util/test_video_audio_float.py
@@ -15,6 +15,8 @@ import pytest
from invokeai.app.util.video_audio import _ffmpeg_exe, extract_audio_pcm
from invokeai.app.util.video_encoding import make_mp4_writer, write_stereo_wav
+pytestmark = pytest.mark.ffmpeg
+
def _sine(rate: int, seconds: float, freq: float) -> np.ndarray:
t = np.arange(int(rate * seconds)) / rate
diff --git a/tests/app/util/test_video_encoding.py b/tests/app/util/test_video_encoding.py
index e93e464e70..9d9665d795 100644
--- a/tests/app/util/test_video_encoding.py
+++ b/tests/app/util/test_video_encoding.py
@@ -18,6 +18,7 @@ from invokeai.app.invocations.video_frame_extract_range import _validate_even_di
from invokeai.app.util.video_encoding import make_mp4_writer, write_stereo_wav
def test_non_multiple_of_16_dimensions_are_preserved(tmp_path: Path) -> None:
# 120x84: even (so yuv420p-encodable) but not a multiple of 16 — the imageio
# default would silently rescale this to 128x96.
@@ -55,7 +56,9 @@ def _ffmpeg_has_encoder(name: str) -> bool:
text=True,
timeout=30,
).stdout
- except (OSError, subprocess.SubprocessError):
+ # RuntimeError: imageio-ffmpeg found no runnable binary. This runs at collection, so it must
+ # not raise where the `ffmpeg` tests are deselected.
+ except (OSError, RuntimeError, subprocess.SubprocessError):
return False
return any(line.split()[1:2] == [name] for line in encoders.splitlines() if line.strip())
@@ -66,6 +69,7 @@ def _write_sine_wav(path: Path, duration_s: float, sample_rate: int = 32_000) ->
write_stereo_wav(path, samples, sample_rate)
def test_audio_path_muxes_an_aac_stream(tmp_path: Path) -> None:
fps, num_frames = 8.0, 8
wav_path = tmp_path / "audio.wav"
@@ -91,6 +95,7 @@ def test_audio_path_muxes_an_aac_stream(tmp_path: Path) -> None:
assert meta["size"] == (120, 84)
@pytest.mark.skipif(not _ffmpeg_has_encoder("libmp3lame"), reason="ffmpeg build lacks the libmp3lame encoder")
def test_audio_codec_is_forwarded_not_defaulted(tmp_path: Path) -> None:
# ffmpeg's default MP4 audio encoder is aac, so the aac test above cannot
@@ -120,6 +125,7 @@ def test_missing_audio_file_fails_fast(tmp_path: Path) -> None:
make_mp4_writer(tmp_path / "out.mp4", fps=8.0, audio_path=tmp_path / "does-not-exist.wav")
def test_no_audio_path_produces_no_audio_stream(tmp_path: Path) -> None:
path = tmp_path / "out.mp4"
writer = make_mp4_writer(path, fps=8.0)
diff --git a/tests/app/util/test_video_ingest.py b/tests/app/util/test_video_ingest.py
index 0258297514..e6a99f9538 100644
--- a/tests/app/util/test_video_ingest.py
+++ b/tests/app/util/test_video_ingest.py
@@ -79,6 +79,7 @@ def m4a_audio(fixture_dir: Path) -> Path:
)
def test_probe_reports_video_and_audio_codecs(h264_mov: Path, wav_audio: Path) -> None:
probe = probe_media_streams(h264_mov)
assert probe.video_codec == "h264"
@@ -89,6 +90,7 @@ def test_probe_reports_video_and_audio_codecs(h264_mov: Path, wav_audio: Path) -
assert probe.audio_codec is not None
def test_probe_rejects_unreadable_bytes(tmp_path: Path) -> None:
garbage = tmp_path / "garbage.mov"
garbage.write_bytes(b"this is not media" * 64)
@@ -104,6 +106,7 @@ def test_plan_covers_each_stream_layout() -> None:
plan_ingest(MediaProbe(video_codec=None, audio_codec=None))
def test_h264_foreign_container_is_remuxed(h264_mov: Path, tmp_path: Path) -> None:
dst = tmp_path / "out.mp4"
assert ingest_media_to_mp4(h264_mov, dst, max_output_bytes=GB) == "remux"
@@ -113,6 +116,7 @@ def test_h264_foreign_container_is_remuxed(h264_mov: Path, tmp_path: Path) -> No
assert pcm is not None, "the AAC track must survive the remux"
def test_foreign_codec_is_transcoded_to_h264(mpeg4_avi: Path, tmp_path: Path) -> None:
dst = tmp_path / "out.mp4"
assert ingest_media_to_mp4(mpeg4_avi, dst, max_output_bytes=GB) == "transcode"
@@ -120,6 +124,7 @@ def test_foreign_codec_is_transcoded_to_h264(mpeg4_avi: Path, tmp_path: Path) ->
assert (width, height, codec) == (64, 48, "h264")
def test_odd_dimensions_are_evened_for_yuv420p(fixture_dir: Path, tmp_path: Path) -> None:
src = _make_media(
fixture_dir / "odd.avi",
@@ -132,6 +137,7 @@ def test_odd_dimensions_are_evened_for_yuv420p(fixture_dir: Path, tmp_path: Path
assert (width, height, codec) == (62, 46, "h264")
@pytest.mark.parametrize("fixture_name", ["wav_audio", "m4a_audio"])
def test_audio_only_uploads_are_wrapped_into_waveform_videos(
fixture_name: str, tmp_path: Path, request: pytest.FixtureRequest
@@ -148,6 +154,7 @@ def test_audio_only_uploads_are_wrapped_into_waveform_videos(
assert pcm is not None
def test_album_art_does_not_make_an_audio_file_a_video(fixture_dir: Path, tmp_path: Path) -> None:
"""An m4a with embedded cover art carries a real (attached-pic) video stream; it must
still be classified audio-only and wrapped, not 'transcoded' into a still image."""
@@ -181,6 +188,7 @@ def test_album_art_does_not_make_an_audio_file_a_video(fixture_dir: Path, tmp_pa
assert ingest_media_to_mp4(src, dst, max_output_bytes=GB) == "audio_wrap"
def test_unreadable_input_raises_user_safe_error(tmp_path: Path) -> None:
garbage = tmp_path / "garbage.mp3"
garbage.write_bytes(b"\x00" * 1024)
@@ -189,6 +197,7 @@ def test_unreadable_input_raises_user_safe_error(tmp_path: Path) -> None:
assert not (tmp_path / "out.mp4").exists() or (tmp_path / "out.mp4").stat().st_size == 0
def test_output_size_cap_is_enforced(h264_mov: Path, tmp_path: Path) -> None:
with pytest.raises(VideoIngestError, match="maximum upload size"):
ingest_media_to_mp4(h264_mov, tmp_path / "out.mp4", max_output_bytes=64)
diff --git a/tests/app/util/test_video_smart_concat.py b/tests/app/util/test_video_smart_concat.py
index d2868a35b2..6e1ffa4c21 100644
--- a/tests/app/util/test_video_smart_concat.py
+++ b/tests/app/util/test_video_smart_concat.py
@@ -14,6 +14,13 @@ from invokeai.app.util.h264_splice import SpliceError
from invokeai.app.util.video_smart_concat import _bridge_sample_entry, encode_rgb_frames
+def no_ffmpeg_lookup(monkeypatch: pytest.MonkeyPatch) -> None:
+ """Tests that replace the ffmpeg process must not need a real binary to name in its command."""
+ monkeypatch.setattr("invokeai.app.util.video_smart_concat.imageio_ffmpeg.get_ffmpeg_exe", lambda: "ffmpeg")
+
+
def test_bridge_encoder_cancellation_reaps_ffmpeg_and_discards_partial_output(tmp_path: Path) -> None:
output = tmp_path / "canceled.mp4"
canceled = [False]
@@ -30,6 +37,7 @@ def test_bridge_encoder_cancellation_reaps_ffmpeg_and_discards_partial_output(tm
assert not output.exists()
def test_bridge_encoder_timeout_stops_a_blocked_frame_source(tmp_path: Path) -> None:
output = tmp_path / "timed-out.mp4"
stop = threading.Event()
@@ -46,7 +54,7 @@ def test_bridge_encoder_timeout_stops_a_blocked_frame_source(tmp_path: Path) ->
assert not output.exists()
-def test_bridge_encoder_reports_process_start_failure(tmp_path: Path) -> None:
+def test_bridge_encoder_reports_process_start_failure(tmp_path: Path, no_ffmpeg_lookup: None) -> None:
output = tmp_path / "no-ffmpeg.mp4"
with patch("invokeai.app.util.video_smart_concat.subprocess.Popen", side_effect=OSError("not found")):
with pytest.raises(SpliceError, match="could not start ffmpeg"):
@@ -55,6 +63,7 @@ def test_bridge_encoder_reports_process_start_failure(tmp_path: Path) -> None:
assert not output.exists()
def test_bridge_encoder_does_not_treat_internal_abort_as_user_cancellation(tmp_path: Path) -> None:
output = tmp_path / "internal-abort.mp4"
abort = threading.Event()
@@ -81,6 +90,7 @@ def test_bridge_encoder_does_not_treat_internal_abort_as_user_cancellation(tmp_p
assert not output.exists()
def test_bridge_source_value_error_is_a_fallback_eligible_splice_error(tmp_path: Path) -> None:
output = tmp_path / "decoder-error.mp4"
frame = np.zeros((64, 64, 3), dtype=np.uint8)
@@ -116,7 +126,9 @@ class _FakeProcess:
return self.returncode
-def test_bridge_encoder_reaps_process_if_worker_thread_cannot_start(tmp_path: Path, monkeypatch) -> None:
+def test_bridge_encoder_reaps_process_if_worker_thread_cannot_start(
+ tmp_path: Path, monkeypatch, no_ffmpeg_lookup: None
+) -> None:
output = tmp_path / "worker-start-failure.mp4"
process = _FakeProcess()
monkeypatch.setattr("invokeai.app.util.video_smart_concat.subprocess.Popen", lambda *args, **kwargs: process)
@@ -133,7 +145,9 @@ def test_bridge_encoder_reaps_process_if_worker_thread_cannot_start(tmp_path: Pa
assert not output.exists()
-def test_bridge_encoder_reaps_process_and_feeder_if_cancel_callback_raises(tmp_path: Path, monkeypatch) -> None:
+def test_bridge_encoder_reaps_process_and_feeder_if_cancel_callback_raises(
+ tmp_path: Path, monkeypatch, no_ffmpeg_lookup: None
+) -> None:
output = tmp_path / "callback-failure.mp4"
process = _FakeProcess()
monkeypatch.setattr("invokeai.app.util.video_smart_concat.subprocess.Popen", lambda *args, **kwargs: process)
diff --git a/tests/app/util/test_video_thumbnails.py b/tests/app/util/test_video_thumbnails.py
index e695abf839..c1e6c32b66 100644
--- a/tests/app/util/test_video_thumbnails.py
+++ b/tests/app/util/test_video_thumbnails.py
@@ -146,6 +146,7 @@ def hanging_worker(monkeypatch: pytest.MonkeyPatch):
monkeypatch.setattr(video_thumbnails, "_worker_command", _hang_command)
class TestHappyPathThroughSubprocess:
def test_probe_returns_metadata(self, synthetic_mp4: Path) -> None:
width, height, duration, fps = probe_video(synthetic_mp4)
@@ -162,6 +163,7 @@ class TestHappyPathThroughSubprocess:
assert decoder_frame_count(synthetic_mp4) == FRAMES
class TestUnreadableInput:
def test_probe_rejects_garbage_bytes(self, tmp_path: Path) -> None:
bogus = tmp_path / "junk.mp4"
@@ -206,6 +208,7 @@ class TestHungDecoderIsBounded:
class TestStreamedDecoderIsBounded:
+ @pytest.mark.ffmpeg
def test_streams_real_frames_through_worker(self, synthetic_mp4: Path) -> None:
frames = list(iter_video_frames(synthetic_mp4))
assert len(frames) == FRAMES
@@ -619,6 +622,7 @@ class TestWorkerDecodeBounds:
worker._assert_decodable_dims(Path("fake.mp4")) # must not raise
class TestStreamBackendFallback:
"""_stream must fall back to cv2 like probe/frame/count do (JPPhoto review
2026-07-21) — a file accepted at upload via the cv2 fallback previously worked in
@@ -1073,6 +1077,7 @@ class TestRepresentativeThumbnailFrame:
assert frame is dark
assert timeouts == [10.0, 5.0]
+ @pytest.mark.ffmpeg
def test_walks_past_a_black_lead_in_through_the_worker(self, ladder_mp4: Path) -> None:
"""End to end: the opening rung and the first deeper rung both decode to black and are
rejected; the search continues to the lit frame instead of settling."""
@@ -1083,6 +1088,7 @@ class TestRepresentativeThumbnailFrame:
assert FrameScore.measure(frame).informative
assert np.asarray(frame).mean() > 60
+ @pytest.mark.ffmpeg
def test_falls_back_to_frame_zero_when_metadata_overstates(self, synthetic_mp4: Path) -> None:
"""Container metadata is untrusted: fps/duration claiming frames that don't exist
(indices 100+ of a 12-frame clip) must still produce a thumbnail (frame 0), not a
@@ -1093,6 +1099,7 @@ class TestRepresentativeThumbnailFrame:
assert abs(value - 32) <= 8 # frame 0
class TestFrameCountOffTheFfmpegBackend:
"""OpenCV without its FFmpeg backend (Media Foundation, in the Windows ARM64 wheel) derives the
frame count from the container duration, which a soundtrack outlasting the video stretches."""