Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

updates

Jareer7df7a97c4380
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 10508f7e..fdf719a1 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,6 +1,6 @@
name: Build App
-# Compiles the WolfCut desktop app for macOS and Windows.
+# Compiles the WolfCut desktop app for macOS, Windows and Linux.
#
# Every build stages the static FFmpeg pair into desktop/src-tauri/ffmpeg/
# first - the release guard in build.rs refuses to build without it, because a
@@ -43,10 +43,27 @@ jobs:
os: macos-latest
- platform: windows
os: windows-latest
+ # 22.04, not latest: bundles link the build machine's glibc and
+ # webkit, so the oldest supported runner is what keeps the deb and
+ # AppImage runnable on older distros.
+ - platform: linux
+ os: ubuntu-22.04
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
+ # Tauri's Linux prerequisites, plus libfuse2 for the AppImage tooling.
+ - name: Linux system libraries
+ if: matrix.platform == 'linux'
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y \
+ libwebkit2gtk-4.1-dev \
+ build-essential curl wget file \
+ libxdo-dev libssl-dev \
+ libayatana-appindicator3-dev librsvg2-dev \
+ libgtk-3-dev libfuse2
+
- uses: actions/setup-node@v4
with:
node-version: 22
@@ -78,6 +95,24 @@ jobs:
desktop/src-tauri/ffmpeg/ffmpeg -version | head -1
desktop/src-tauri/ffmpeg/ffprobe -version | head -1
+ # Same static-build service as macOS, linux/amd64 flavour.
+ - name: Stage bundled FFmpeg (Linux)
+ if: matrix.platform == 'linux'
+ run: |
+ set -euo pipefail
+ mkdir -p desktop/src-tauri/ffmpeg ffdl
+ curl -fsSL --retry 5 --retry-all-errors -o ffdl/ffmpeg.zip \
+ "https://ffmpeg.martin-riedl.de/redirect/latest/linux/amd64/release/ffmpeg.zip"
+ curl -fsSL --retry 5 --retry-all-errors -o ffdl/ffprobe.zip \
+ "https://ffmpeg.martin-riedl.de/redirect/latest/linux/amd64/release/ffprobe.zip"
+ unzip -o ffdl/ffmpeg.zip -d ffdl/ffmpeg-out
+ unzip -o ffdl/ffprobe.zip -d ffdl/ffprobe-out
+ mv "$(find ffdl/ffmpeg-out -type f -name ffmpeg | head -1)" desktop/src-tauri/ffmpeg/ffmpeg
+ mv "$(find ffdl/ffprobe-out -type f -name ffprobe | head -1)" desktop/src-tauri/ffmpeg/ffprobe
+ chmod +x desktop/src-tauri/ffmpeg/ffmpeg desktop/src-tauri/ffmpeg/ffprobe
+ desktop/src-tauri/ffmpeg/ffmpeg -version | head -1
+ desktop/src-tauri/ffmpeg/ffprobe -version | head -1
+
- name: Stage bundled FFmpeg (Windows)
if: matrix.platform == 'windows'
shell: pwsh
@@ -117,6 +152,19 @@ jobs:
"$staged" -version | head -1
done
+ - name: Verify FFmpeg made it into the bundle (Linux)
+ if: matrix.platform == 'linux'
+ run: |
+ set -euo pipefail
+ deb="$(find desktop/src-tauri/target/release/bundle/deb -name '*.deb' | head -1)"
+ test -n "$deb" || { echo "no .deb produced"; exit 1; }
+ dpkg-deb -x "$deb" unpacked
+ for binary in ffmpeg ffprobe; do
+ staged="$(find unpacked -type f -path '*resources*' -name "$binary" | head -1)"
+ test -n "$staged" && test -x "$staged" || { echo "$binary missing from the deb or not executable"; exit 1; }
+ "$staged" -version | head -1
+ done
+
- uses: actions/upload-artifact@v4
with:
name: WolfCut-${{ matrix.platform }}
@@ -124,6 +172,9 @@ jobs:
desktop/src-tauri/target/release/bundle/dmg/*.dmg
desktop/src-tauri/target/release/bundle/msi/*.msi
desktop/src-tauri/target/release/bundle/nsis/*.exe
+ desktop/src-tauri/target/release/bundle/deb/*.deb
+ desktop/src-tauri/target/release/bundle/rpm/*.rpm
+ desktop/src-tauri/target/release/bundle/appimage/*.AppImage
if-no-files-found: error
release:
@@ -157,3 +208,6 @@ jobs:
bundles/**/*.dmg
bundles/**/*.msi
bundles/**/*.exe
+ bundles/**/*.deb
+ bundles/**/*.rpm
+ bundles/**/*.AppImage
diff --git a/README.md b/README.md
index 2d2a8a12..76770ef7 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@
[![UI](https://img.shields.io/badge/ui-React%20%2B%20Tauri-24C8DB?logo=tauri&logoColor=white)](desktop)
[![Version](https://img.shields.io/badge/version-0.1.0-blue)](https://github.com/jub0t/WolfCut)
-<img src="assets/screenshot-light.png" alt="WolfCut editor" width="100%" />
+<img src="assets/screenshot-dark.png" alt="WolfCut editor" width="100%" />
</div>
diff --git a/assets/screenshot-dark.png b/assets/screenshot-dark.png
index c214061f..8fc4d48e 100644
Binary files a/assets/screenshot-dark.png and b/assets/screenshot-dark.png differ
diff --git a/assets/screenshot-light.png b/assets/screenshot-light.png
index c6c397b1..901bdf70 100644
Binary files a/assets/screenshot-light.png and b/assets/screenshot-light.png differ
diff --git a/desktop/src-tauri/src/export.rs b/desktop/src-tauri/src/export.rs
index 2fe4364e..d72e0306 100644
--- a/desktop/src-tauri/src/export.rs
+++ b/desktop/src-tauri/src/export.rs
@@ -688,6 +688,7 @@ pub fn preview_frame(
let mut sources: Vec<(std::sync::Arc<Frame>, f32, Transform)> =
Vec::with_capacity(plan.layers.len());
+ let mut failures: Vec<String> = Vec::new();
for layer in &plan.layers {
let (decode_width, decode_height) = decode_sizes
.get(&layer.clip)
@@ -696,7 +697,7 @@ pub fn preview_frame(
let chain = filter_chains.get(&layer.clip).map(String::as_str);
// A source that fails to decode contributes nothing rather than
// blanking the monitor - same grace the exporter extends.
- if let Ok(frame) = pool.frame_at(
+ match pool.frame_at(
std::path::Path::new(&layer.media),
layer.source_time,
decode_width,
@@ -704,10 +705,22 @@ pub fn preview_frame(
stills.contains(&layer.clip),
chain,
) {
- sources.push((frame, layer.opacity, layer.transform));
+ Ok(frame) => sources.push((frame, layer.opacity, layer.transform)),
+ Err(error) => failures.push(format!("{}: {error}", layer.media.display())),
}
}
+ // Planned layers with nothing decoded is a failed preview, not a black
+ // frame: compositing zero sources yields opaque black, and the caller
+ // would draw that "truth" over its own perfectly good approximation. An
+ // *empty plan* still composites - a gap in the timeline really is black.
+ if sources.is_empty() && !plan.layers.is_empty() {
+ return Err(format!(
+ "no layer decoded for the paused preview: {}",
+ failures.join(" / ")
+ ));
+ }
+
// The same fraction-to-pixel placement the exporter applies.
let layers: Vec<Layer<'_>> = sources
.iter()
@@ -774,6 +787,76 @@ mod tests {
Some(TransitionSpec { kind: kind.to_owned(), duration })
}
+ /// End to end against a real FFmpeg: the paused monitor's frame must show
+ /// the footage, not an empty composite. Skips silently without FFmpeg.
+ #[test]
+ fn preview_frame_shows_the_footage_not_black() {
+ use relay_core::frame::Frame;
+ use relay_media::{EncodeOptions, FfmpegEncoder, FrameSink};
+
+ let path = std::env::temp_dir().join("relay-preview-test.mp4");
+ let Ok(mut encoder) = FfmpegEncoder::create(
+ &path,
+ 64,
+ 64,
+ FrameRate::THIRTY,
+ &EncodeOptions::default(),
+ ) else {
+ return; // no ffmpeg here
+ };
+ for _ in 0..30 {
+ let mut frame = Frame::black(64, 64);
+ frame.fill([200, 30, 30, 255]);
+ encoder.write_frame(&frame).expect("writes");
+ }
+ encoder.finish().expect("finishes");
+
+ let mut request_clip = clip("video", 0, 0.0, 1.0, 0.0);
+ request_clip.path = path.to_string_lossy().into_owned();
+ request_clip.media_width = Some(64);
+ request_clip.media_height = Some(64);
+ let request = PreviewFrameRequest {
+ time: 0.5,
+ width: 64,
+ height: 64,
+ rate_num: 30,
+ rate_den: 1,
+ clips: vec![request_clip],
+ };
+
+ let mut pool = relay_media::ReaderPool::new(16 * 1024 * 1024, 2);
+ let bytes = preview_frame(&mut pool, &request).expect("previews");
+ assert_eq!(bytes.len(), 64 * 64 * 4);
+ let centre = (32 * 64 + 32) * 4;
+ assert!(
+ bytes[centre] > 120 && bytes[centre + 1] < 90,
+ "centre pixel should be red-ish, got {:?}",
+ &bytes[centre..centre + 4],
+ );
+
+ // A clip trimmed past its media's end: the paused monitor at that
+ // time must show the last real frame, not a black composite and not
+ // an error. This is the exact shape that used to black the monitor.
+ let mut outliving = clip("video", 0, 0.0, 3.0, 0.0);
+ outliving.path = path.to_string_lossy().into_owned();
+ let late = PreviewFrameRequest {
+ time: 2.5,
+ width: 64,
+ height: 64,
+ rate_num: 30,
+ rate_den: 1,
+ clips: vec![outliving],
+ };
+ let bytes = preview_frame(&mut pool, &late).expect("previews past the media's end");
+ assert!(
+ bytes[centre] > 120 && bytes[centre + 1] < 90,
+ "past the end should freeze on the last frame, got {:?}",
+ &bytes[centre..centre + 4],
+ );
+
+ let _ = std::fs::remove_file(&path);
+ }
+
#[test]
fn a_cross_fade_overlaps_the_incoming_clip_on_its_own_lane() {
let mut clips = vec![clip("video", 0, 0.0, 4.0, 0.0), clip("video", 0, 4.0, 4.0, 2.0)];
diff --git a/desktop/src-tauri/src/lib.rs b/desktop/src-tauri/src/lib.rs
index 3cdcaa53..9cab8651 100644
--- a/desktop/src-tauri/src/lib.rs
+++ b/desktop/src-tauri/src/lib.rs
@@ -526,6 +526,9 @@ async fn preview_frame(
})
.await
.map_err(|error| format!("preview task failed: {error}"))?
+ // The UI quietly keeps its approximation on error, which is right for
+ // the monitor and useless for debugging - so the reason lands here.
+ .inspect_err(|error| eprintln!("relay: preview_frame: {error}"))
.map(tauri::ipc::Response::new)
}
diff --git a/desktop/src/components/MediaBin.tsx b/desktop/src/components/MediaBin.tsx
index 1a359cfb..0b704e5a 100644
--- a/desktop/src/components/MediaBin.tsx
+++ b/desktop/src/components/MediaBin.tsx
@@ -469,8 +469,12 @@ Drag onto a track, or double-click to add at the playhead`}
>
<MediaThumb item={item} assets={assets} />
- <span className="pointer-events-none absolute left-1 top-1 flex h-5 w-5
- items-center justify-center rounded bg-black/55 text-white">
+ <span
+ className="pointer-events-none absolute left-1 top-1 flex h-5 w-5
+ items-center justify-center rounded text-white"
+ // The kind's own hue, matching the clip it becomes on a track.
+ style={{ background: KIND_TINTS[item.kind].mark }}
+ >
<Icon
name={item.kind === "video" ? "film" : item.kind === "image" ? "image" : "music"}
size={11}
@@ -566,10 +570,14 @@ function TextPage({ onAddText }: { onAddText: () => void }) {
>
<div
className="relative flex aspect-video items-center justify-center overflow-hidden
- rounded-lg bg-sunken ring-1 ring-hairline transition-shadow
+ rounded-lg ring-1 ring-hairline transition-shadow
group-hover:ring-hairline-strong"
+ // Titles wear the rose the timeline gives them.
+ style={{ background: "var(--color-clip-text-body)" }}
>
- <span className="text-xl font-semibold text-primary">Aa</span>
+ <span className="text-xl font-semibold" style={{ color: "var(--color-clip-text)" }}>
+ Aa
+ </span>
</div>
<span className="mt-1 block truncate text-[11px] leading-tight text-secondary">
Default title
@@ -780,6 +788,17 @@ Click to start a new project from this template`}
// ── thumbnails ───────────────────────────────────────────────────────────────
+/**
+ * Each media kind's hue pair - the vivid mark and the darker same-hue ground
+ * it sits on - matching the timeline's clip palette, so a card in the bin and
+ * the clip it becomes read as the same thing.
+ */
+const KIND_TINTS: Record<MediaItem["kind"], { mark: string; body: string }> = {
+ video: { mark: "var(--color-clip-video)", body: "var(--color-clip-video-body)" },
+ audio: { mark: "var(--color-clip-audio)", body: "var(--color-clip-audio-body)" },
+ image: { mark: "var(--color-clip-image)", body: "var(--color-clip-image-body)" },
+};
+
/**
* The bin preview for one item.
*
@@ -846,13 +865,18 @@ function MediaThumb({ item, assets }: { item: MediaItem; assets: MediaAssets })
return;
}
+ // The wave sits on its own darker orange rather than on the panel's
+ // near-black - the same two-intensity pair the timeline clip uses.
+ context.fillStyle = themeColor("clip-audio-body", "#33220e");
+ context.fillRect(0, 0, width, height);
+
// The whole file squeezed into the thumbnail, extremes per column so a
// transient does not vanish at this scale.
const centre = height / 2;
const half = height / 2 - 1;
const buckets = peaks.max.length;
- context.fillStyle = themeColor("clip-audio", "#2f8a68");
+ context.fillStyle = themeColor("clip-audio", "#f09e2f");
context.beginPath();
for (let column = 0; column < width; column += 1) {
const from = Math.floor((column / width) * buckets);
@@ -877,10 +901,18 @@ function MediaThumb({ item, assets }: { item: MediaItem; assets: MediaAssets })
}, [assets, item]);
return (
- <span className="relative block aspect-video w-full overflow-hidden bg-sunken">
+ <span
+ className="relative block aspect-video w-full overflow-hidden"
+ // The kind's darker hue as the ground, so a card without artwork yet is
+ // already colour-coded rather than a black hole.
+ style={{ background: KIND_TINTS[item.kind].body }}
+ >
<canvas ref={canvasRef} className="h-full w-full" />
{!hasArt && (
- <span className="absolute inset-0 flex items-center justify-center text-tertiary">
+ <span
+ className="absolute inset-0 flex items-center justify-center"
+ style={{ color: KIND_TINTS[item.kind].mark }}
+ >
<Icon name={item.kind === "video" ? "film" : item.kind === "image" ? "image" : "music"} size={14} />
</span>
)}
diff --git a/desktop/src/components/Preview.tsx b/desktop/src/components/Preview.tsx
index 761664c8..69e2d0bd 100644
--- a/desktop/src/components/Preview.tsx
+++ b/desktop/src/components/Preview.tsx
@@ -604,7 +604,11 @@ export function Preview({
*/}
{frameRect && titleOverlays.length > 0 && (
<div
- className="absolute overflow-hidden"
+ // pointer-events-none is load-bearing: this div covers the whole
+ // frame above the transform gizmo, and a transparent div still
+ // hit-tests. Without it, nothing inside the frame is clickable -
+ // each title box re-enables its own pointer events.
+ className="pointer-events-none absolute overflow-hidden"
style={{
left: frameRect.left,
top: frameRect.top,
diff --git a/desktop/src/components/TimelinePanel.tsx b/desktop/src/components/TimelinePanel.tsx
index beb45941..afcf9043 100644
--- a/desktop/src/components/TimelinePanel.tsx
+++ b/desktop/src/components/TimelinePanel.tsx
@@ -85,6 +85,9 @@ function refreshCanvasPalette(): void {
PALETTE.image.header = themeColor("clip-image", PALETTE.image.header);
PALETTE.image.body = themeColor("clip-image-body", PALETTE.image.body);
PALETTE.image.edge = PALETTE.image.header;
+ PALETTE.text.header = themeColor("clip-text", PALETTE.text.header);
+ PALETTE.text.body = themeColor("clip-text-body", PALETTE.text.body);
+ PALETTE.text.edge = PALETTE.text.header;
}
/** Where one clip sat when a move began, so the whole set moves rigidly. */
@@ -1250,27 +1253,27 @@ function ellipsize(context: CanvasRenderingContext2D, text: string, maxWidth: nu
/** Clip fills, refreshed alongside COLORS. See `refreshCanvasPalette`. */
const PALETTE = {
video: {
- body: "#16283d",
- header: "#2b6ca8",
- edge: "#2b6ca8",
+ body: "#142640",
+ header: "#4d8df6",
+ edge: "#4d8df6",
},
audio: {
- body: "#123027",
- header: "#2f8a68",
- edge: "#2f8a68",
- wave: "rgba(190,240,216,0.65)",
+ body: "#33220e",
+ header: "#f09e2f",
+ edge: "#f09e2f",
+ wave: "rgba(250,214,158,0.7)",
},
image: {
- body: "#241a38",
- header: "#7b53c4",
- edge: "#7b53c4",
+ body: "#251a3d",
+ header: "#8b5cf6",
+ edge: "#8b5cf6",
},
- // Amber, distinct from the three media kinds: a title is the one thing on
+ // Rose, distinct from the three media kinds: a title is the one thing on
// the timeline that is not a file, and it should not be mistaken for one.
text: {
- body: "#3a2a11",
- header: "#c08a2e",
- edge: "#c08a2e",
+ body: "#38131d",
+ header: "#e8355e",
+ edge: "#e8355e",
},
};
diff --git a/desktop/src/styles.css b/desktop/src/styles.css
index e0eeebbc..55ee5766 100644
--- a/desktop/src/styles.css
+++ b/desktop/src/styles.css
@@ -114,13 +114,21 @@
--color-tool-active-bg: rgba(0, 0, 0, 0.08);
--color-playhead: #ff3b30;
- --color-clip-video: #0a6cc4;
- --color-clip-video-body: #cfe3f7;
- --color-clip-audio: #1f8a5f;
- --color-clip-audio-body: #cfeade;
- --color-clip-wave: rgba(20, 80, 55, 0.55);
- --color-clip-image: #8a5cd6;
- --color-clip-image-body: #e2d7f6;
+ /*
+ * One hue per media kind, in two intensities: a vivid mark and a pale
+ * same-hue body it sits on. Blue footage, orange sound, purple stills,
+ * rose titles - four kinds, four hues, and the pair structure is what
+ * keeps a waveform readable on its own clip.
+ */
+ --color-clip-video: #2f6fe0;
+ --color-clip-video-body: #d3e2fb;
+ --color-clip-audio: #d97f16;
+ --color-clip-audio-body: #fae6c8;
+ --color-clip-wave: rgba(140, 85, 10, 0.55);
+ --color-clip-image: #7743e8;
+ --color-clip-image-body: #e4dbfa;
+ --color-clip-text: #d41f4d;
+ --color-clip-text-body: #fad7df;
--color-timeline: #e4e4e9;
--color-timeline-alt: #ededf1;
--color-ruler: #f4f4f6;
@@ -190,13 +198,15 @@
--color-success: #30d158;
--color-playhead: #ff453a;
- --color-clip-video: #2b6ca8;
- --color-clip-video-body: #16283d;
- --color-clip-audio: #2f8a68;
- --color-clip-audio-body: #123027;
- --color-clip-wave: rgba(190, 240, 216, 0.65);
- --color-clip-image: #7b53c4;
- --color-clip-image-body: #241a38;
+ --color-clip-video: #4d8df6;
+ --color-clip-video-body: #142640;
+ --color-clip-audio: #f09e2f;
+ --color-clip-audio-body: #33220e;
+ --color-clip-wave: rgba(250, 214, 158, 0.7);
+ --color-clip-image: #8b5cf6;
+ --color-clip-image-body: #251a3d;
+ --color-clip-text: #e8355e;
+ --color-clip-text-body: #38131d;
--color-timeline: #0d0d10;
--color-timeline-alt: #0a0a0d;
--color-ruler: #131316;
diff --git a/engine/crates/relay-media/src/pool.rs b/engine/crates/relay-media/src/pool.rs
index a7744d28..9e8edb6f 100644
--- a/engine/crates/relay-media/src/pool.rs
+++ b/engine/crates/relay-media/src/pool.rs
@@ -260,6 +260,11 @@ struct MediaFacts {
rate: FrameRate,
/// A still image: one frame, served for every requested time.
still: bool,
+ /// Whole frames the container claims to hold, when it states a duration.
+ /// Requests past this clamp to the last frame *before* any seek happens -
+ /// a seek past the end produces zero frames, not an error and not a
+ /// picture.
+ frames: Option<i64>,
}
/// Random access to frames across many files, cache in front, warm readers
@@ -310,7 +315,14 @@ impl ReaderPool {
) -> Result<Arc<Frame>> {
let facts = self.facts_for(path, still)?;
let rate = facts.rate;
- let target = if facts.still { 0 } else { rate.frame_at(time).max(0) };
+ let mut target = if facts.still { 0 } else { rate.frame_at(time).max(0) };
+ // A clip can outlive its media - an end-trim past the file's length -
+ // and the honest picture for any time past the end is the last frame,
+ // exactly what the roll-forward case already serves. Clamp before
+ // seeking: `-ss` past the end decodes nothing at all.
+ if let Some(frames) = facts.frames {
+ target = target.min((frames - 1).max(0));
+ }
let chain_key = chain.map(str::to_owned);
let key = FrameKey {
@@ -356,6 +368,51 @@ impl ReaderPool {
}
}
+ // Nothing at all means the seek itself landed past the end of the
+ // picture stream - a container whose video ends before its audio, or
+ // a stated duration that lied past the clamp above. The last real
+ // frame is still the honest answer; it just has to be found by
+ // seeking backwards until something decodes. Each retry doubles the
+ // step, and the last one starts from zero, so a file with any
+ // decodable picture at all cannot fail here.
+ if latest.is_none() {
+ for step in [30i64, 240, i64::MAX] {
+ let from = target.saturating_sub(step).max(0);
+ reader.seek(rate, from)?;
+ loop {
+ match reader.next_frame(rate)? {
+ Some((index, frame)) => {
+ let frame = Arc::new(frame);
+ self.cache.insert(
+ FrameKey {
+ path: path.to_path_buf(),
+ width,
+ height,
+ chain: chain_key.clone(),
+ index,
+ },
+ Arc::clone(&frame),
+ );
+ latest = Some(frame);
+ if index >= target {
+ break;
+ }
+ }
+ None => break,
+ }
+ }
+ if latest.is_some() || from == 0 {
+ break;
+ }
+ }
+ if let Some(frame) = &latest {
+ // Remember the answer under the index that was asked for, so
+ // dwelling on a time past the end costs one lookup, not a
+ // respawn-and-decode per request.
+ self.cache.insert(key, Arc::clone(frame));
+ }
+ }
+
latest.ok_or_else(|| crate::error::Error::PartialFrame {
path: path.to_path_buf(),
got: 0,
@@ -366,7 +423,7 @@ impl ReaderPool {
fn facts_for(&mut self, path: &Path, still: bool) -> Result<&MediaFacts> {
if !self.facts.contains_key(path) {
let facts = if still {
- MediaFacts { rate: FrameRate::THIRTY, still: true }
+ MediaFacts { rate: FrameRate::THIRTY, still: true, frames: None }
} else {
let info = probe::probe(path)?;
let rate = info
@@ -374,7 +431,13 @@ impl ReaderPool {
.as_ref()
.map(|video| video.frame_rate)
.unwrap_or(FrameRate::THIRTY);
- MediaFacts { rate, still: false }
+ // Ceil rather than floor: undercounting by one would clamp
+ // legitimate requests for the true last frame.
+ let frames = info
+ .duration
+ .map(|duration| (duration * rate.fps()).ceil())
+ .filter(|count| *count > 0);
+ MediaFacts { rate, still: false, frames }
};
self.facts.insert(path.to_path_buf(), facts);
}
@@ -524,6 +587,12 @@ mod tests {
assert_eq!(again_at_50, at_50, "revisit must come from cache, identical");
assert!(pool.cache.len() > 0, "rolling forward populated the cache");
+ // Far past the end - a clip that outlives its media. The last real
+ // frame is the answer, not an error: a seek there decodes nothing,
+ // which used to surface as PartialFrame(0 bytes) and a black monitor.
+ let past_end = red_at(&mut pool, 300);
+ assert!(near(past_end, 89), "past the end read {past_end}, wanted the last frame");
+
let _ = std::fs::remove_file(&path);
}
}