How to play a video frame by frame? Do not use ffme:MediaElement! #595
-
|
I want to develop a program similar to video editing software, so I need to obtain each frame of the image rather than playing it with a player control. To test the feasibility, I wrote the following code, but I found that the screen flickered. private async Task PlayFramesAsync(Player player)
{
const int FrameRate = 24;
const int FrameIntervalMs = 1000 / FrameRate;
long totalDurationMs = player.Duration / 1000;
for (int ms = 0; ms < totalDurationMs; ms += FrameIntervalMs)
{
player.Seek(ms);
using var bitmap = player.TakeSnapshotToBitmap();
if (bitmap != null)
{
image.Source = BitmapToBitmapSource(bitmap);
}
await Task.Delay(FrameIntervalMs);
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Hi @CodingOctocat, did you check the FlyleafExtractor (WinForms)? For seek/duration confusion I understand your frustration. |
Beta Was this translation helpful? Give feedback.
Then you might want to check those too:-
https://github.com/SuRGeoNix/Flyleaf.FFmpeg.Generator
https://github.com/SuRGeoNix/Flyleaf.FFmpeg
https://github.com/SuRGeoNix/Flyleaf.FFmpeg.Samples