[PR #254] [CLOSED] Tune CameraMan effect: faster randomized motion segments with explicit still holds #252

Closed
opened 2026-03-02 04:00:55 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/eerimoq/moblin/pull/254
Author: @Copilot
Created: 2/26/2026
Status: Closed

Base: mainHead: copilot/update-cameraman-video-effect


📝 Commits (4)

  • f5ada67 Initial plan
  • 095b1ed Tune CameraMan effect with faster moves and still segments
  • aa3ef88 Refine cameraman tests and expose timing constants
  • 5e11779 Randomize and speed up cameraman segment pacing

📊 Changes

2 files changed (+143 additions, -15 deletions)

View changed files

📝 Moblin/VideoEffects/CameraManEffect.swift (+95 -15)
MoblinTests/CameraManEffectSuite.swift (+48 -0)

📄 Description

CameraMan’s motion was continuously sinusoidal, which made the effect feel overly floaty. This change shifts it to a staged movement pattern: quicker transitions between viewpoints with periodic stillness.

  • Motion model update

    • Replaced continuous sin/cos drift with segment-based interpolation.
    • Updated baseline timing to be about 2x faster:
      • movementDuration = 1.5s
      • stillDuration = 0.5s
    • Added deterministic per-segment randomness to:
      • movement duration
      • still duration
      • movement speed factor
    • During movement segments, position/scale interpolate with smoothStep for quick but non-jarring travel.
    • During still segments, crop rect remains fixed (intentional camera hold).
  • Implementation refactor

    • Added deterministic crop computation helper:
      • cropRect(width:height:elapsed:)
    • Added segment timing helper for randomized per-segment timing:
      • segmentInfo(elapsed:)
    • execute(...) now consumes computed cropRect directly (translation/scale derived from rect).
  • Focused coverage

    • Added CameraManEffectSuite with targeted assertions:
      • crop rect is constant across the still window
      • crop rect changes across the movement window
      • segment timing and speed factors vary across segments
    • Tests now use runtime segment info so they remain valid with randomized durations.
let movementProgress = min(segment.elapsedInSegment / segment.movementDuration, 1)
let progress = if movementProgress == 1 {
    1
} else {
    min(movementProgress * segment.speedFactor, 1)
}
let easedProgress = smoothStep(progress)

Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/eerimoq/moblin/pull/254 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 2/26/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `copilot/update-cameraman-video-effect` --- ### 📝 Commits (4) - [`f5ada67`](https://github.com/eerimoq/moblin/commit/f5ada6757ffb0378d0bf5d3669f7eae442188cdf) Initial plan - [`095b1ed`](https://github.com/eerimoq/moblin/commit/095b1eddd750c521651cb5d5830672acb4f9bd20) Tune CameraMan effect with faster moves and still segments - [`aa3ef88`](https://github.com/eerimoq/moblin/commit/aa3ef882cc12ce961113b0a215e03c5c9a39cf11) Refine cameraman tests and expose timing constants - [`5e11779`](https://github.com/eerimoq/moblin/commit/5e117798c08fcd9bc5664e71cc7bf1c77f9413d0) Randomize and speed up cameraman segment pacing ### 📊 Changes **2 files changed** (+143 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `Moblin/VideoEffects/CameraManEffect.swift` (+95 -15) ➕ `MoblinTests/CameraManEffectSuite.swift` (+48 -0) </details> ### 📄 Description CameraMan’s motion was continuously sinusoidal, which made the effect feel overly floaty. This change shifts it to a staged movement pattern: quicker transitions between viewpoints with periodic stillness. - **Motion model update** - Replaced continuous `sin/cos` drift with **segment-based interpolation**. - Updated baseline timing to be about **2x faster**: - `movementDuration = 1.5s` - `stillDuration = 0.5s` - Added deterministic per-segment randomness to: - movement duration - still duration - movement speed factor - During movement segments, position/scale interpolate with `smoothStep` for quick but non-jarring travel. - During still segments, crop rect remains fixed (intentional camera hold). - **Implementation refactor** - Added deterministic crop computation helper: - `cropRect(width:height:elapsed:)` - Added segment timing helper for randomized per-segment timing: - `segmentInfo(elapsed:)` - `execute(...)` now consumes computed `cropRect` directly (translation/scale derived from rect). - **Focused coverage** - Added `CameraManEffectSuite` with targeted assertions: - crop rect is constant across the still window - crop rect changes across the movement window - segment timing and speed factors vary across segments - Tests now use runtime segment info so they remain valid with randomized durations. ```swift let movementProgress = min(segment.elapsedInSegment / segment.movementDuration, 1) let progress = if movementProgress == 1 { 1 } else { min(movementProgress * segment.speedFactor, 1) } let easedProgress = smoothStep(progress) ``` - **<screenshot>** - https://github.com/user-attachments/assets/7969ec16-cc53-4e59-bb86-c0a037be395c <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/eerimoq/moblin/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 04:00:55 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/moblin#252
No description provided.