Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: skip 0-byte video files and improve unavailable frame UI

Louis Beaumont9cdeec45ccea
diff --git a/screenpipe-app-tauri/components/rewind/image-card.tsx b/screenpipe-app-tauri/components/rewind/image-card.tsx
index 7a0021c37..156331585 100644
--- a/screenpipe-app-tauri/components/rewind/image-card.tsx
+++ b/screenpipe-app-tauri/components/rewind/image-card.tsx
@@ -57,8 +57,9 @@ const FrameImage = ({ frameId, alt }: { frameId: number; alt: string }) => {
</div>
)}
{hasError ? (
- <div className="absolute inset-0 flex items-center justify-center bg-muted">
+ <div className="absolute inset-0 flex flex-col items-center justify-center bg-muted gap-1">
<ImageOff className="h-5 w-5 text-muted-foreground" />
+ <span className="text-xs text-muted-foreground">frame unavailable</span>
</div>
) : (
<img
diff --git a/screenpipe-server/src/video_cache.rs b/screenpipe-server/src/video_cache.rs
index e1b39e7ca..b03258c8e 100644
--- a/screenpipe-server/src/video_cache.rs
+++ b/screenpipe-server/src/video_cache.rs
@@ -658,6 +658,14 @@ async fn extract_frame(
frame_tx: FrameChannel,
cache_tx: mpsc::Sender<CacheMessage>,
) -> Result<usize> {
+ // Skip empty/corrupted video files early to avoid pointless ffmpeg calls
+ if let Ok(metadata) = tokio::fs::metadata(&video_file_path).await {
+ if metadata.len() == 0 {
+ debug!("skipping empty video file (0 bytes): {}", video_file_path);
+ return Ok(0);
+ }
+ }
+
if !is_video_file_complete(&ffmpeg, &video_file_path).await? {
debug!("skipping incomplete video file: {}", video_file_path);
return Ok(0);