fix(gate): the space-reclaim class is about the PICTURES, not the audio codec

An h264 mp4 with an mp3 track was excluded from the 0.990 second tier, but encode() already
re-encodes non-AAC audio to AAC in the same pass (-c:a aac -b:a <source kbps>), so that track is
fixed whichever picture bar applies. Holding the PICTURE to 0.995 because of it is exactly the
rule that the size ceiling makes unreachable. Renamed plays_everywhere -> space_reclaim_source
to say what it actually decides (owner 2026-10-25: 「把音轨转 AAC 后也按二档跑」).
This commit is contained in:
hoelee committed 2026-10-25 04:32:18 +08:00
1 parent 57e950da8f
commit 64a80d2234
1 file changed
+11 -9
+11 -9
View File
@@ -1254,17 +1254,19 @@ def dst_path_for(src, container="mp4"):
return TR.out_path_for(src, container)
def plays_everywhere(info, src):
"""True when the file AS IT STANDS already plays on an iPad and on Android.
def space_reclaim_source(info, src):
"""The conversion's ONLY remaining job is reclaiming disk: the PICTURES already play everywhere.
H.264 in an mp4-family container with AAC audio is the one combination both platforms decode
natively - which is what decides whether a conversion's only remaining job is to reclaim disk
space (`SSIM_MEAN_MIN_REDO`) or whether it is also a playability fix that must not be relaxed.
H.264 in an mp4-family container is the combination an iPad and an Android phone decode natively.
AUDIO deliberately does not enter into this: `encode()` re-encodes any non-AAC track to AAC in the
same pass (`-c:a aac -b:a <source kbps>`, the branch just below), so an mp3/mp2 track is fixed no
matter which picture bar applies - it must not be a reason to hold the PICTURE to 0.995, which is
the bar the size ceiling makes unreachable (owner 2026-10-25: 「把音轨转 AAC 后也按二档跑」).
A source that needs the picture re-decoded (VP9/AV1) or the container rebuilt (mkv) is NOT this
class: there the conversion is a playability fix and keeps the strict bar.
"""
if info["vcodec"] not in ("h264", "avc1"):
return False
if info["acodec"] not in ("aac", "mp4a"):
return False
return os.path.splitext(src)[1].lower() in (".mp4", ".m4v", ".mov")
@@ -1478,7 +1480,7 @@ def process(src, args, dest=None, origin=None):
capped = bool(vbps) and obps >= vbps * SIZE_CEIL * CAP_BOUND_SHARE
second_tier = False
if (systematic and mean is not None and bad_share <= MAX_BAD_SHARE
and mean >= SSIM_MEAN_MIN_FALLBACK and plays_everywhere(info, src)):
and mean >= SSIM_MEAN_MIN_FALLBACK and space_reclaim_source(info, src)):
second_tier, systematic = True, False
note = ("second tier %.3f: the source already plays everywhere, so this is a "
"space-reclaim job (mean %.4f, %s%.0f%% of the source video)"
@@ -1510,7 +1512,7 @@ def process(src, args, dest=None, origin=None):
# the production record says the gear ladder cannot fix it: 194 of 202 files with
# two measured rounds moved by < 0.0015, i.e. the ceiling ate the extra bits.
tail = ""
if plays_everywhere(info, src) and bad_share <= MAX_BAD_SHARE:
if space_reclaim_source(info, src) and bad_share <= MAX_BAD_SHARE:
tail = (" ; the second tier %.3f was not met either%s - no gear change can "
"move this class (owner 2026-10-25)"
% (SSIM_MEAN_MIN_FALLBACK,