Elias pc->laptop

This commit is contained in:
unknown
2025-07-05 14:10:48 +02:00
parent 739e5ccfa6
commit 2abed3f2d8
237 changed files with 12168 additions and 1809 deletions

View File

@@ -21,11 +21,12 @@ public static class VideoFrameExtractor
using (var mp = new MediaPlayer(media))
{
mp.Play();
mp.Volume = 0;
while (!mp.IsPlaying)
Thread.Sleep(10);
// Seek to ~200th frame at 30 fps
// Seek to ~200th frame at 30 fpsA
mp.Time = (long)((200.0 / 30.0) * 1000);
Thread.Sleep(500);
@@ -35,7 +36,7 @@ public static class VideoFrameExtractor
Thread.Sleep(1000);
if (!mp.TakeSnapshot(0, path, 0, 0))
throw new Exception("Snapshot failed.");
return null;
// Wait for snapshot file to be fully written and valid
int attempts = 10;
@@ -51,12 +52,19 @@ public static class VideoFrameExtractor
}
if (!File.Exists(path))
throw new FileNotFoundException("Snapshot file not found", path);
{
Console.WriteLine($"[ERROR] Snapshot file not found at {path} for video: {videoPath}");
// Return null instead of throwing
return null;
}
var fileInfo = new FileInfo(path);
if (fileInfo.Length == 0)
throw new Exception("Snapshot file is empty or corrupted.");
{
Console.WriteLine($"[ERROR] Snapshot file is empty or corrupted at {path} for video: {videoPath}");
// Return null instead of throwing
return null;
}
// Load BitmapImage on the UI thread
BitmapImage image = Application.Current.Dispatcher.Invoke(() =>
{