fix: log on read_video_frame_at failure; os.path.join in stitch_video#155
Merged
nikopueringer merged 1 commit intonikopueringer:mainfrom Mar 14, 2026
Merged
Conversation
Two small fixes in backend/: 1. backend/frame_io.py — read_video_frame_at() returned None silently when cap.read() failed (bad seek or truncated video). Unlike its sibling read_image_frame(), no warning was emitted, making the failure invisible to callers and log aggregation. Added logger.warning() with the frame index and path, matching the existing pattern in read_image_frame(). 2. backend/ffmpeg_tools.py — stitch_video() built the FFmpeg -i input path with string concatenation (in_dir + "/" + pattern), the only remaining hardcoded slash in the file. Replaced with os.path.join() for cross-platform consistency; os is already imported. No logic changes. 221 tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Two small fixes in
backend/— no logic changes.1.
backend/frame_io.py— silentNoneinread_video_frame_at()When
cap.read()fails (bad seek, truncated video, corrupted file),read_video_frame_at()returnedNonewith no log output. Its siblingread_image_frame()already emitslogger.warning("Could not read frame: %s", fpath)in the same situation.read_video_frame_at()was inconsistent — the failure was completely invisible to callers and log handlers.Added
logger.warning("Could not read video frame %d from: %s", frame_index, video_path)immediately before thereturn None, matching the existing pattern.2.
backend/ffmpeg_tools.py— hardcoded/institch_video()The FFmpeg
-iinput path was built with string concatenation (in_dir + "/" + pattern), the only remaining hardcoded slash in the file after theos.path.joinfixes in PR #100. Replaced withos.path.join(in_dir, pattern);osis already imported at line 15.Why it was needed
Nonereturns make debugging failed video reads difficult — there's no log message to indicate which file or frame index caused the problem./breaks on Windows paths; the rest offfmpeg_tools.pyalready usesos.path.joinconsistently.How to verify