feat(video): honor URL t=/start= timestamp as a playback start offset#37
Merged
Conversation
Quick playback (`c64cast MEDIA…`) now starts a URL at its own timestamp with no new flag: `?t=`/`&start=`/`#t=` (accepting 90, 90s, 1m30s, 1h2m3s) is parsed by quickcast._parse_start_offset and sets the scene's start offset. - SceneCfg.start_s (video-only; negative rejected, non-video rejected) threads through VideoScene into AVFileSource. - AVFileSource seeks the container to the keyframe at/just-before start_s (whole -container seek, AV_TIME_BASE microseconds, backward) before demux starts, and the peak-scan container seeks too so normalization covers the played portion. - The demux loop rebases every video frame's PTS by the first decoded frame so playback restarts at ~0 and tracks the from-0 audio/wall clock; the no-seek path is unchanged. Accuracy is keyframe-granular; A/V stay aligned. Applied as a PyAV seek (not a yt-dlp download-section) so it also covers direct media URLs and config-driven [[scenes]] videos, with no temp download. Docs (CLAUDE.md, usage.md, example TOML) + schema regenerated. Tests: timestamp parsers, start_s validation, and a fake-container demux PTS-rebase unit test.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #37 +/- ##
==========================================
+ Coverage 79.43% 79.54% +0.10%
==========================================
Files 68 68
Lines 12770 12817 +47
Branches 1877 1889 +12
==========================================
+ Hits 10144 10195 +51
+ Misses 2193 2185 -8
- Partials 433 437 +4 ☔ View full report in Codecov by Harness. |
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
Playing a URL with a timestamp previously ignored it and started at 0:00. Now a
quick-playback URL begins at its own timestamp, with no new CLI flag — the
lowest-friction path stays low-friction:
?t=/&start=/#t=are honored, accepting90,90s,1m30s,1h2m3s.How
quickcast._parse_start_offsetparses the timestamp off the original URL(the resolved stream URL doesn't carry it) and sets the scene's start offset.
SceneCfg.start_s(video-only; negative rejected, set-on-non-videorejected) threads through
VideoSceneintoAVFileSource.AVFileSourceseeks the container to the keyframe at/just-beforestart_s(whole-container seek in AV_TIME_BASE microseconds,
backward) before thedemux thread starts; the audio peak-scan container seeks too so normalization
reflects the played portion.
playback restarts at ~0 and tracks the from-0 audio/wall clock. The no-seek
path is unchanged (offset ≈ 0).
Applied as a PyAV seek, not a yt-dlp download-section: no temp download, and
it also covers direct media URLs and config-driven
[[scenes]]videos(
start_s = N). Accuracy is keyframe-granular (start lands within one GOP);A/V stay aligned. Exact-to-the-second start (decode-and-discard) is left as a
future refinement.
Docs + schema
CLAUDE.md, docs/usage.md, and the example TOML document
start_s; the JSONschema is regenerated.
Tests
_parse_timestr/_parse_start_offset): query params,fragment,
h/m/sforms, garbage → None.classify_urlsetsstart_sfrom a URL timestamp.start_svalidation: accepted on video, negative rejected, rejected onnon-video.
Full suite green; schema in sync.