mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-14 21:15:06 +00:00
fix(mux): strip encoding dates from MP4Box and shaka-packager output
MP4Box gets -for-test (non-MP4 inputs keep their tkhd flags) and shaka decrypts get --use_fake_clock_for_muxer, so MP4 and --no-mux files carry no download time.
This commit is contained in:
@@ -96,7 +96,7 @@ def test_dts_uhd_audio_routes_the_mux_to_mp4(tmp_path: Path, monkeypatch: pytest
|
||||
assert out.suffix == ".mp4", "a DTS-UHD title must not be delivered as Matroska"
|
||||
assert returncode == 0 and not errors
|
||||
command = captured[0].args
|
||||
assert command[0] == "MP4Box"
|
||||
assert command[:2] == ["MP4Box", "-for-test"]
|
||||
assert command[-2:] == ["-new", str(out)]
|
||||
assert f"{tmp_path / 'a.mp4'}:lang=en" in command
|
||||
# the child must not inherit the terminal that the live progress tree is drawing on
|
||||
@@ -170,7 +170,7 @@ def test_mp4_subtitles_get_the_script_their_region_implies(tmp_path: Path, monke
|
||||
|
||||
tracks.mux("Title", delete=False, output_path=tmp_path / "out.muxed.mkv")
|
||||
command = captured[0].args
|
||||
assert f"{tmp_path / 's.vtt'}:lang=zh-Hant-TW" in command
|
||||
assert f"{tmp_path / 's.vtt'}:lang=zh-Hant-TW:tkhd=enable,movie,preview" in command
|
||||
assert any(arg.endswith("=Chinese (Traditional)") for arg in command)
|
||||
|
||||
|
||||
|
||||
@@ -123,7 +123,12 @@ def mp4box_commands(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> list[lis
|
||||
|
||||
monkeypatch.setattr(binaries, "MP4Box", Path("/bin/MP4Box"), raising=False)
|
||||
monkeypatch.setattr(tracks_module.subprocess, "Popen", FakePopen)
|
||||
monkeypatch.setattr(tracks_module, "run_step", lambda command, **kwargs: commands.append([str(c) for c in command]))
|
||||
|
||||
def run_step(command: list[Any], output: Path, **kwargs: Any) -> None:
|
||||
commands.append([str(c) for c in command])
|
||||
output.write_bytes(b"cut")
|
||||
|
||||
monkeypatch.setattr(tracks_module, "run_step", run_step)
|
||||
monkeypatch.setattr(config, "sample", None)
|
||||
monkeypatch.setattr(config.directories, "temp", tmp_path)
|
||||
return commands
|
||||
@@ -136,6 +141,15 @@ def test_a_3d_mp4_mux_keeps_the_sample_whole(
|
||||
Tracks(stereo_video(tmp_path))._mux_mp4(title="Film", output_path=tmp_path / "out.mkv")
|
||||
assert len(mp4box_commands) == 1
|
||||
assert "-splitx" not in mp4box_commands[0]
|
||||
assert "-for-test" in mp4box_commands[0]
|
||||
|
||||
|
||||
def test_a_2d_mp4_sample_cut_keeps_no_date(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, mp4box_commands: list[list[str]]
|
||||
) -> None:
|
||||
monkeypatch.setattr(config, "sample", (120.0, 180.0))
|
||||
Tracks(stereo_video(tmp_path, stereo=False))._mux_mp4(title="Film", output_path=tmp_path / "out.mkv")
|
||||
assert mp4box_commands[1][1:3] == ["-for-test", "-splitx"]
|
||||
|
||||
|
||||
def test_a_3d_mp4_mux_writes_quicktime_chapters(tmp_path: Path, mp4box_commands: list[list[str]]) -> None:
|
||||
|
||||
@@ -122,6 +122,7 @@ def test_shaka_decrypt_passes_the_built_keys(monkeypatch: pytest.MonkeyPatch, tm
|
||||
|
||||
keys = seen[0][seen[0].index("--keys") + 1]
|
||||
assert _shaka_zero_entries(keys) == [VIDEO_KEY]
|
||||
assert "--use_fake_clock_for_muxer" in seen[0]
|
||||
|
||||
|
||||
def test_a_rebuilt_widevine_does_not_take_the_first_pssh_kid_as_its_own() -> None:
|
||||
|
||||
Reference in New Issue
Block a user