Choose the lighter copy of a film: 1080p before a 4K remux
13 Nov: American Werewolf played its 54 Mbps 4K HDR copy with DTS-HD MA and drifted out of sync, while a 10 Mbps 1080p AC3 copy was in the library (Night of the Comet the same: 89 Mbps 4K DV vs 7 Mbps 1080p). resolveFilm now orders copies by copyWeight (4K, high bitrate, lossless-only sound count against), then id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -63,3 +63,20 @@ class DolbyVisionCopyTest {
|
||||
assertEquals("h264", sourceVideoCodec(source("None", "h264")))
|
||||
}
|
||||
}
|
||||
|
||||
/** 13 November 2026: American Werewolf's 54 Mbps 4K copy drifted out of sync; its 10 Mbps 1080p copy was in the library. */
|
||||
class CopyChoiceTest {
|
||||
private fun copy(id: String, width: Int, bitrate: Long, vararg audio: Pair<String, String>) = FilmCandidate(id, "An American Werewolf in London", 1981, "tt0082010",
|
||||
listOf(JSONObject().put("Id", "src$id").put("Container", "mkv").put("Bitrate", bitrate).put("RunTimeTicks", 97 * 60_000L * 10_000)
|
||||
.put("MediaStreams", JSONArray().put(JSONObject().put("Type", "Video").put("Codec", if (width > 1920) "hevc" else "h264").put("Width", width))
|
||||
.also { a -> audio.forEach { (c, p) -> a.put(JSONObject().put("Type", "Audio").put("Codec", c).put("Profile", p)) } })))
|
||||
@Test fun theLighterCopyIsChosen() {
|
||||
val heavy = copy("aaa1", 3840, 54_488_349, "dts" to "DTS-HD MA", "dts" to "DTS")
|
||||
val light = copy("zzz9", 1920, 9_647_280, "ac3" to "")
|
||||
val found = resolveFilm(FilmIdentity("An American Werewolf in London", 1981), listOf(heavy, light))
|
||||
assertEquals("zzz9", found.film!!.id)
|
||||
assertTrue(copyWeight(heavy) > copyWeight(light))
|
||||
// With only the 4K copy, it's still used.
|
||||
assertEquals("aaa1", resolveFilm(FilmIdentity("An American Werewolf in London", 1981), listOf(heavy)).film!!.id)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user