How to get a specific frame from a video file?
Products: Media Player SDK .Net
Using the classic Windows-only SDK engines
You can use the Helpful_GetFrameFromFile
method of VisioForge.Core.VideoEdit.VideoEditCore
or VisioForge.Core.MediaPlayer.MediaPlayerCore
classes.
Using the new cross-platform X-engine
Use the MediaInfoReaderX
class to get the current video frame as an image. The frame will be decoded and returned as a System.Drawing.Bitmap
, SKBitmap
, or RGB byte array.
Get the frame as a System.Drawing.Bitmap
.
var bitmap = MediaInfoReaderX.GetFileSnapshotBitmap("C:\\video.mp4", TimeSpan.Zero);
Get the frame as a SkiaSharp SKBitmap
.
var bitmap = MediaInfoReaderX.GetFileSnapshotSKBitmap("C:\\video.mp4", TimeSpan.Zero);
Get the frame as an RGB byte array.
var bitmap = MediaInfoReaderX.GetFileSnapshotRGB("C:\\video.mp4", TimeSpan.Zero);
Visit our GitHub page to get more code samples.