Skip to content

Never save a clip shorter than its card says, and keep a gaming choice - #215

Merged
ColinGPT9 merged 1 commit into
mainfrom
fix/issue-213
Nov 5, 2026
Merged

ColinGPT9 merged 1 commit into
mainfrom
fix/issue-213

Conversation

@ColinGPT9

Copy link
Copy Markdown
Owner

Issue #213 (app 2.1.0, an RTX 5070 Ti): a clip's card said 64s but it played for 0:02, and the facecam sat where it was in the stream instead of in a split. The report also described the wrong video. This fixes three bugs behind that. Refs #213, which stays open: one cause of the missing split needs a real gaming VOD to check (see below).

1. A clip that played for 2 seconds while its card said 64

  • The card shows the clip's planned window (end_s - start_s). Nothing compared that window to the file.
  • How the file came out short:
    • The tracked render decodes on the GPU (video/encoding.py:sampled_frames), which reads FFmpeg exiting early as the end of the clip.
    • Only a decoder that gave no frames fell back to the CPU, although produce's docstring promised a fallback "if the stream ends early".
    • A decoder that stopped partway left a short clip. -shortest cut the audio to match, the end card was added, and the clip was saved with its full window.
  • Fix: finish on the CPU. video/cropper.py checks the frames written against the clip's frame count. If the GPU stopped more than half a second short, it seeks OpenCV to that frame and finishes there.
  • Fix: measure before saving. core/pipeline.py _finish measures each clip first. A file under 90% of what it was made as is reported through the existing "Render failed for …" line and isn't saved. The short file is deleted unless a clip already points at it. A file that can't be measured passes.

Checked on a real 1080p60 clip (20 s, NVENC, with the GPU decoder forced to stop at a third):

Render Length Video frames
main, decoder working 20.0 s 1200
this PR, decoder working 20.0 s 1200, byte-identical to main
main, decoder stops at a third 6.6 s 396 (the bug)
this PR, decoder stops at a third 20.0 s 1200

When the decoder stops, frames 0–395 are identical to the normal render. From the switch on, they differ only by the CPU's decode rounding: about 45 dB PSNR, never below 41.9. So no frame is skipped or repeated.

2. Gaming scores with the plain crop

  • The cause:
    • Vertical Live's "Gaming / reaction" content on a 16:9 file is refused as not vertical.
    • "Use standard processing" then dropped only vertical_live, so the job kept gaming_scoring and laid the clips out with the standard crop.
    • In 2.1.0 the standard crop's automatic facecam check fails on a small overlay webcam, which is the reporter's screenshot.
  • The fix: _standard_retry turns that into Gaming / Reaction (gaming: true), the 16:9 form of the choice. A plain Vertical Live retry is unchanged. queue.retry gains updates next to drop.
  • Not in this PR:
    • The other route to the same picture is the gaming renderer handing a clip back to the standard crop (gaming/run.py:render, "camera fills the frame").
    • Per the gaming rule, that needs checking on a real gaming VOD with an overlay facecam before anything changes.
    • Their job log would say which route it was. With fix 3, the next report will include it.

3. The bug report described the wrong video

The Feedback Hub's "see what will be shared" preview passed the chosen video, but Send didn't. So every report fell back to the latest job's video: #213 named "дверистрим" and arrived with a deleted Twitch VOD's details. Send now passes video_id: realVideoId().

Checks

  • ruff: clean.
  • New tests:
    • tests/test_render_length.py:
      • the threshold;
      • refuse and delete;
      • keep a file an older clip uses;
      • pass a full file, and pass an unmeasurable one;
      • CPU finish after a stop at 8 of 30 frames;
      • no change when the decoder finishes.
    • A gaming-retry test in tests/test_vertical_live.py.
    • tests/test_ui_feedback_report.py.
  • Full suite, full environment (numpy, OpenCV, FastAPI): all pass.
  • CI-light venv: all pass except three SDK new tests, which fail the same way on unchanged main inside a Windows venv.
  • Plugin venv: 7 tests fail on a missing cv2 in my local venv, and they fail the same way on unchanged main.

🤖 Generated with Claude Code

Issue #213: a clip's card said 64s and it played for 2, with the facecam
left where it sat in the stream instead of a split.

- The tracked render decodes on the GPU, and sampled_frames reads FFmpeg
  exiting early as the end of the clip. Only a decoder that gave nothing
  fell back to the CPU, so a decoder that stopped partway left a short
  clip: -shortest cut the audio to match and it was saved with its full
  window. The renderer now finishes on the CPU from the frame the GPU
  stopped at. On a real 1080p60 clip with the decoder stopped at a third,
  main made 6.6s of 20; this makes all 20s. With the decoder working, the
  output is byte-identical to main's.
- Each clip is measured before it's saved. One that came out under 90% of
  its length is reported as a failed render and not saved, whatever made
  it short.
- "Use standard processing" on a job Vertical Live refused dropped only
  vertical_live. A job that asked for its gaming content kept gaming
  scoring and got the plain crop. It now runs as Gaming / Reaction, the
  16:9 form of that choice.
- The Feedback Hub sent reports without the video picked in them, so the
  diagnostics described the last job's video instead (here a deleted
  Twitch VOD). Send now passes it, like the preview.

Refs #213

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clips-kitty-web Ready Ready Preview Nov 5, 2026 3:45am UTC
1 Skipped Deployment
Project Deployment Actions Updated
clips-studio Ignored Ignored Nov 5, 2026 3:45am UTC

@ColinGPT9
ColinGPT9 merged commit bb00383 into main Nov 5, 2026
12 checks passed
@ColinGPT9
ColinGPT9 deleted the fix/issue-213 branch November 5, 2026 03:50

This branch was successfully deployed

1 active deployment
Preview – clips-kitty-web — 11934cbe Deployed Nov 5, 2026 by vercel[bot]
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.

1 participant