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 <noreply@anthropic.com>
This commit is contained in:
lrnselfreliance 2026-11-02 17:59:49 -07:00 • committed by Roland
parent 6c8ea61eaa
commit b8122a4637
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
2 changed files with 8 additions and 0 deletions

View file

@ -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*$')

View file

@ -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):