Skip to content

Fix transcoding corruption handling: distinguish corruption vs encoder failures, add AV1 leniency#387

Merged
ShaneIsrael merged 5 commits intodevelopfrom
copilot/investigate-file-corruption-issue
Jan 18, 2026
Merged

Fix transcoding corruption handling: distinguish corruption vs encoder failures, add AV1 leniency#387
ShaneIsrael merged 5 commits intodevelopfrom
copilot/investigate-file-corruption-issue

Conversation

Copy link
Contributor

Copilot AI commented Jan 18, 2026

AV1-encoded source files are being falsely flagged as corrupt due to warnings like "Corrupt frame detected" that commonly occur during initial frame decoding of valid AV1 files. Additionally, when files fail validation, the log incorrectly says "all encoders failed" even though no encoders were tried.

Changes

Return type change for transcode_video_quality()

  • Returns (success: bool, failure_reason: str | None) instead of bool
  • Distinguishes between 'corruption' (source file issue) and 'encoders' (transcoding failure)
success, failure_reason = util.transcode_video_quality(video_path, out_path, 1080, use_gpu, timeout)
if success:
    # ...
elif failure_reason == 'corruption':
    logger.warning(f"Skipping video {id} - source file appears corrupt")
else:
    logger.warning(f"Skipping video {id} - all encoders failed")

AV1-specific validation leniency

  • Added AV1_FALSE_POSITIVE_INDICATORS frozenset for warnings that are benign in AV1 files
  • Added AV1_CODEC_NAMES frozenset for codec detection
  • When decode test succeeds (returncode 0) for AV1 files, ignore known false positive warnings
  • Severe indicators like "moov atom not found" still fail validation
Original prompt

It seems all these corruption issues are coming from files that are already encoded in AV1, is that a problem? Also, if a corrupted file is detected is it not resetting the check for failed encoders? Just because 1 file fails doesn't mean it should skip subsequent files due to all encoders failed. Encoders failing should only stick if the file is not corrupted and they still failed. Please investigate if anything of what I said seems true and if you have an idea of a good clean solution.

2026-01-17 17:25:54,658 WARNING util.transcode_video_quality:448 | Skipping transcoding for this video due to file corruption or read errors
2026-01-17 17:25:54,658 WARNING cli.transcode_videos:576 | Skipping video 79c39c1d9956062c348ef23f84d0de43 720p transcode - all encoders failed
2026-01-17 17:25:54,660 INFO cli.transcode_videos:548 | Transcoding d95d30642a4cd3a5931f98d752ae8972 to 1080p
2026-01-17 17:25:54,937 ERROR util.transcode_video_quality:447 | Source video validation failed: Video file appears to be corrupt: Corrupt frame detected
2026-01-17 17:25:54,937 WARNING util.transcode_video_quality:448 | Skipping transcoding for this video due to file corruption or read errors
2026-01-17 17:25:54,937 WARNING cli.transcode_videos:557 | Skipping video d95d30642a4cd3a5931f98d752ae8972 1080p transcode - all encoders failed
2026-01-17 17:25:54,938 INFO cli.transcode_videos:567 | Transcoding d95d30642a4cd3a5931f98d752ae8972 to 720p
2026-01-17 17:25:55,154 ERROR util.transcode_video_quality:447 | Source video validation failed: Video file appears to be corrupt: Corrupt frame detected
2026-01-17 17:25:55,154 WARNING util.transcode_video_quality:448 | Skipping transcoding for this video due to file corruption or read errors
2026-01-17 17:25:55,154 WARNING cli.transcode_videos:576 | Skipping video d95d30642a4cd3a5931f98d752ae8972 720p transcode - all encoders failed
2026-01-17 17:25:55,156 INFO cli.transcode_videos:548 | Transcoding 140225ec5a628450bdfaf85fa2b9e946 to 1080p
2026-01-17 17:25:55,324 ERROR util.transcode_video_quality:447 | Source video validation failed: Video file appears to be corrupt: Corrupt frame detected
2026-01-17 17:25:55,324 WARNING util.transcode_video_quality:448 | Skipping transcoding for this video due to file corruption or read errors
2026-01-17 17:25:55,324 WARNING cli.transcode_videos:557 | Skipping video 140225ec5a628450bdfaf85fa2b9e946 1080p transcode - all encoders failed
2026-01-17 17:25:55,324 INFO cli.transcode_videos:567 | Transcoding 140225ec5a628450bdfaf85fa2b9e946 to 720p
2026-01-17 17:25:55,461 ERROR util.transcode_video_quality:447 | Source video validation failed: Video file appears to be corrupt: Corrupt frame detected
2026-01-17 17:25:55,461 WARNING util.transcode_video_quality:448 | Skipping transcoding for this video due to file corruption or read errors
2026-01-17 17:25:55,461 WARNING cli.transcode_videos:576 | Skipping video 140225ec5a628450bdfaf85fa2b9e946 720p transcode - all encoders failed
2026-01-17 17:25:55,462 INFO cli.transcode_videos:548 | Transcoding 42c29a354f6feb41fd11b3d7633a0c85 to 1080p
2026-01-17 17:25:56,016 ERROR util.transcode_video_quality:447 | Source video validation failed: Video file appears to be corrupt: Corrupt frame detected
2026-01-17 17:25:56,016 WARNING util.transcode_video_quality:448 | Skipping transcoding for this video due to file corruption or read errors
2026-01-17 17:25:56,016 WARNING cli.transcode_videos:557 | Skipping video 42c29a354f6feb41fd11b3d7633a0c85 1080p transcode - all encoders failed
2026-01-17 17:25:56,017 INFO cli.transcode_videos:567 | Transcoding 42c29a354f6feb41fd11b3d7633a0c85 to 720p
2026-01-17 17:25:56,491 ERROR util.transcode_video_quality:447 | Source video validation failed: Video file appears to be corrupt: Corrupt frame detected
2026-01-17 17:25:56,491 WARNING util.transcode_video_quality:448 | Skipping transcoding for this video due to file corruption or read errors
2026-01-17 17:25:56,491 WARNING cli.transcode_videos:576 | Skipping video 42c29a354f6feb41fd11b3d7633a0c85 720p transcode - all encoders failed
2026-01-17 17:25:56,493 INFO cli.transcode_videos:548 | Transcoding 034fa386784a4b15c0d47bfa3446fc17 to 1080p
2026-01-17 17:25:57,146 ERROR util.transcode_video_quality:447 | Source video validation failed: Video file appears to be corrupt: Corrupt frame detected
2026-01-17 17:25:57,146 WARNING util.transcode_video_quality:448 | Skipping transcoding for this video due to file corruption or read errors
2026-01-17 17:25:57,146 WARNING cli.transcode_videos:557 | Skipping video 034fa386784a4b15c0d47bfa3446fc17 1080p transcode - all encoders failed
2026-01-17 17:25:57,146 INFO cli.transcode_videos:567 | Transcoding 034fa386784a4b15c0d47bfa3446fc17 to 720p
2026-01-17 17:25:57,717 ERROR util.transcode_video_quality:447 | Source video validation failed: Video file appears to be corrupt: Corrupt frame detected


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Investigate encoder failures related to corrupted files Fix transcoding corruption handling: distinguish corruption vs encoder failures, add AV1 leniency Jan 18, 2026
Copilot AI requested a review from ShaneIsrael January 18, 2026 00:47
@ShaneIsrael ShaneIsrael marked this pull request as ready for review January 18, 2026 00:49
@ShaneIsrael ShaneIsrael merged commit 7829aef into develop Jan 18, 2026
@ShaneIsrael ShaneIsrael deleted the copilot/investigate-file-corruption-issue branch January 31, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants