save-qp writes a QP file with ` I ` lines for scene boundaries.
(test_video_file, tmp_path)
| 168 | |
| 169 | @pytest.mark.release |
| 170 | def test_cli_save_qp_smoke(test_video_file, tmp_path): |
| 171 | """save-qp writes a QP file with `<frame> I <shift>` lines for scene boundaries.""" |
| 172 | result = _run( |
| 173 | [ |
| 174 | "-i", |
| 175 | os.path.abspath(test_video_file), |
| 176 | "-o", |
| 177 | str(tmp_path), |
| 178 | "detect-content", |
| 179 | "save-qp", |
| 180 | ], |
| 181 | cwd=os.path.abspath(os.path.dirname(test_video_file) + "/../.."), |
| 182 | ) |
| 183 | assert result.returncode == 0, f"stderr:\n{result.stderr}\nstdout:\n{result.stdout}" |
| 184 | qp_files = [p for p in tmp_path.iterdir() if p.suffix == ".qp"] |
| 185 | assert qp_files, "save-qp produced no .qp file" |
| 186 | contents = qp_files[0].read_text().strip() |
| 187 | assert contents, "save-qp produced an empty file" |
| 188 | # Each line must be `<frame_number> I <shift>` where shift is an integer. |
| 189 | for line in contents.splitlines(): |
| 190 | parts = line.split() |
| 191 | assert len(parts) == 3 and parts[0].isdigit() and parts[1] == "I", ( |
| 192 | f"Malformed QP line: {line!r}" |
| 193 | ) |
| 194 | int(parts[2]) # shift must parse as int (may be negative) |
| 195 | |
| 196 | |
| 197 | @pytest.mark.release |