From b8122a463772a8a1c699f60d6ac1aea0fb3cf945 Mon Sep 17 00:00:00 2001 From: lrnselfreliance <33263708+lrnselfreliance@users.noreply.github.com> Date: Mon, 2 Nov 2026 17:59:49 -0700 Subject: [PATCH] The tail-decode check ignores the h264 decoder's "mmco: unref short failure" note (#938) After a download, ffmpeg decodes the last 30 seconds of the video and any stderr line not on the ignore list marks the video incomplete. Seeking into an h264 stream can make the decoder print "mmco: unref short failure": a note about reference-picture marking for frames before the seek point. The frames decode and ffmpeg exits 0, but the verdict was "Video was incomplete", so the download was deferred and the same sound video was downloaded again on every retry. Co-authored-by: Claude Fable 5.1 --- modules/videos/common.py | 3 +++ modules/videos/test/test_common.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/modules/videos/common.py b/modules/videos/common.py index 723ef9cb..2b726e84 100644 --- a/modules/videos/common.py +++ b/modules/videos/common.py @@ -153,9 +153,12 @@ def tail_decode_command(video_path: Path, seconds: int = None) -> Tuple[str | Pa # The null muxer complains about duplicate timestamps after the frames have decoded; it is not damage. +# The h264 decoder's "mmco: unref short failure" is a reference-marking note about the frames before the +# seek point; the frames decode and ffmpeg exits 0. Judging it as damage re-downloads a sound video forever. # A repeat summary only counts the previous message, whose first copy is still judged. TAIL_DECODE_IGNORED_ERRORS = re.compile( r'^\[null @ \w+] Application provided invalid, non monotonically increasing dts' + r'|^\[h264 @ \w+] mmco: unref short failure\s*$' r'|^\s*Last message repeated \d+ times\s*$') diff --git a/modules/videos/test/test_common.py b/modules/videos/test/test_common.py index 596fa10c..c5ca0f28 100644 --- a/modules/videos/test/test_common.py +++ b/modules/videos/test/test_common.py @@ -674,6 +674,7 @@ def test_ffmpeg_video_complete_real_files(test_directory, video_file): NULL_MUXER_DTS = b'[null @ 0x5555faf7fa70] Application provided invalid, non monotonically increasing dts to muxer' \ b' in stream 0: 460 >= 460\n' +H264_MMCO = b'[h264 @ 0x555627ef0f70] mmco: unref short failure\n' @pytest.mark.parametrize('return_code,stderr,expected_ok,expected_errors', [ @@ -687,6 +688,10 @@ NULL_MUXER_DTS = b'[null @ 0x5555faf7fa70] Application provided invalid, non mon '[h264 @ 0x1] Invalid NAL unit size'), (0, NULL_MUXER_DTS + b'[h264 @ 0x1] Invalid NAL unit size\n', False, '[h264 @ 0x1] Invalid NAL unit size'), (0, b'[h264 @ 0x1] error while decoding MB 3 4\n', False, '[h264 @ 0x1] error while decoding MB 3 4'), + # The h264 decoder notes a reference-marking quirk at the seek point; the frames decoded and ffmpeg exited 0. + (0, H264_MMCO, True, ''), + (0, H264_MMCO + b' Last message repeated 1 times\n', True, ''), + (0, H264_MMCO + b'[h264 @ 0x1] Invalid NAL unit size\n', False, '[h264 @ 0x1] Invalid NAL unit size'), (1, NULL_MUXER_DTS, False, ''), ]) def test_tail_decode_verdict(return_code, stderr, expected_ok, expected_errors):