Repository navigation
Kept typed-rate and sampled encodes on the source frames they stand for - #104
Merged
Merged
Conversation
A typed rate now goes into the one -vf chain, ahead of the scale or pad, as fps=N:round=up, which shows at each output frame the source frame on screen at that instant. An output -r kept every frame until it fell more than a frame behind, so 50 fps taken to 25 showed the source frame three before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw74tPQDnDqyNERnS42
The copy cut rebases a stretch on its audio, which starts before the keyframe the video is cut at, so the video started a little after zero and the constant-rate encode repeated its first frame into the gap, putting every later frame one behind the source frame the A/B window pairs it with. Sampled encodes of cut stretches now lead their -vf with setpts=PTS-STARTPTS; the command shown, the whole-file encode and the trim of a file with no keyframe table are unchanged. The measurement cache keys a square on that same command, so squares measured before are measured again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw74tPQDnDqyNERnS42
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw74tPQDnDqyNERnS42
…r each instant
fps=N:round=up took a source frame only if its timestamp was not even a hair
past the output instant, so a source with millisecond-rounded or jittered
timestamps decimated unevenly: 30 fps taken to 15 stepped 1, 3 and 2 source
frames. A typed rate now moves every frame earlier by samplingLeadSeconds, an
eighth of a source frame (settb=AVTB,setpts before the fps filter, folded into
the setpts that starts a cut stretch at zero), and the A/B window reads the
original at the same lead, which also pairs source-rate encodes of such
sources correctly.
Measured on native ffmpeg 6.1.1 and the wasm core (5.1), identical on both:
millisecond 30->15 steps {1:150, 2:149, 3:150} became {2:449}, +-2 ms jitter
30->15 {1:106, 2:239, 3:105} became {2:449}, and millisecond 59.94->29.97
became all 2. At the source's own rate the A/B paired 17 to 27 of every 60
frames of those sources with the source frame before; now none.
Exact-timestamp sources (50->25, 30->24/20/15/7.5/1, 29.97->14.985,
59.94->29.97, 25->30, 30->60, VFR, late-starting video, cut stretches) pick
the same frames at the same sizes and keyframes. Where an output instant
falls less than the lead before a source frame's start (100 of 751 slots of
29.97->25, 150 of 1800 of 25->60) it now takes that frame, and the A/B pairs
it with the same one. Without settb a 1/30 time-base source showed the next
frame everywhere.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DQrzw74tPQDnDqyNERnS42
…ests compareTab's trim test sliced the arguments after -i inline, the same thing segmentRun's tests did with a local afterInput. It now lives in tests/unit/helpers/ffmpegArgs.ts (named apart from helpers/arguments.ts, which is about call-argument limits) and both files import it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw74tPQDnDqyNERnS42
The it.each named its rows with %o, which no other test does, and its second assertion ignored the row it ran for. The rows now carry a $label, the first passes no options at all so the default is what is checked, and the row-blind assertion is gone (the chain check already pins it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw74tPQDnDqyNERnS42
A separate test rebuilt the same trim inputs only to check the -vf chain. The trim test now runs at a typed rate and checks the chain itself; it still fails if a trimmed stretch is moved to zero. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw74tPQDnDqyNERnS42
Nothing failed if inBrowserEncode passed startVideoAtZero to the builder, which on a source whose video starts after its audio (0.1 s on the probe's nob30late.mp4) would play every frame of the user's output that much early against the copied audio. The whole-file test now checks the command has no STARTPTS. It checks STARTPTS rather than setpts because a typed rate's sampling lead puts a setpts in every command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw74tPQDnDqyNERnS42
Passing startVideoAtZero to the builder for the Reencode tab's command (cliControls) or Full Analysis's Command Builder block (analysisTab) left the whole unit suite passing, though either is the command a user copies and runs on their whole file. Each test now checks its command has no STARTPTS, and each fails its own mutation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw74tPQDnDqyNERnS42
…ctly B-frame sources such as the reference demo still show the encoded pane two frames behind (the edit-list offset this branch leaves alone), so the entry now says the samples no longer fall an extra frame behind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw74tPQDnDqyNERnS42
…ce's The lead was an eighth of a source frame whatever the typed rate, so at eight times the source's rate or more it was a whole output frame or more, put the first source frame before zero, and the encode started that many frames later than the A/B window paired them. It is now an eighth of a frame of the faster of the source's rate and the typed one, and the A/B window reads the original at the lead of the rate the encode was made at. Measured on native ffmpeg 6.1.1 and the wasm core (5.1.4), identical on both, with lossless encodes content-matched against the source: 30 fps typed 240 paired 59 of 480 frames with the source frame after the one shown, 3 fps typed 30 paired 29 of 300 so, and 1 fps typed 30 lost a frame (299 of 300) and paired 18; all now pair every frame, with the frame counts, durations and keyframes of the encodes before the lead. 25 fps typed 200 and a copy-cut 30 fps stretch typed 240 likewise. Typed rates at or below the source's keep the lead they had. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw74tPQDnDqyNERnS42
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw74tPQDnDqyNERnS42
|
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
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.
Two encode-side offsets the real-Chromium probe found after #103.
-rkept each source frame until it had fallen more than a frame behind, so 50 to 25 fps showed the frame 3 before the one on screen, and 30 to 24 fps 1 or 2 before. A typed rate is now anfps=N:round=upfilter in the-vfchain, ahead of the scale or pad, with no-r. This changes the displayed command, the whole-file encode, Reencode samples and Compare squares.round=upalone judders on timestamps rounded to the millisecond (common after a remux out of Matroska) or jittered by a few ms: 30 to 15 fps stepped 1, 3 and 2 source frames. Asettb=AVTB,setpts=PTS-<lead>/TBahead of the filter takes each frame an eighth of a frame after its instant (an eighth of the faster of the source and typed rates). The A/B window reads the original at the same lead.-STARTPTS). The whole-file and displayed commands do not, and Compare squares cached from the old command are measured again.Probe, main → this branch, in source frames behind the original pane (most frames):
Native ffmpeg 6.1 and the in-browser core (5.1) give the same frames. Encoded frame rate and keyframe spacing are unchanged. Samples no longer encode the frames past the stretch end.
Left open: the reference demo's -2 is the B-frame edit-list item of #86. A variable-rate source with no typed rate still shows the next frame in about a third of slots. Files without a keyframe table, trimmed rather than cut, can still be off by up to half an output frame at a typed rate (main was off by 2 to 5).
No Chromatic snapshot change expected.
Prompts
Generated by Claude Code