Closed smartelligence closed 3 years ago
This seems unsolvable since this is "by design"... In the documentation is noted: FFMediaToolkit will also work with any other graphics library that supports creating images from Span
Is there any change to circumvent the use of the ImageData data structure?
With the latest release, you can write the decoded bitmap directly to the WPF WriteableBitmap
buffer using the TryReadFrameToPointer
method
Dim file As FileStream = New FileStream("path to the video file", FileMode.Open, FileAccess.Read)
Dim media As MediaFile = MediaFile.Load(file)
Dim bmp As WriteableBimap = New WriteableBitmap(media.Video.Info.FrameSize.Width, media.Video.Info.FrameSize.Height, 96, 96, PixelFormats.Bgr24, Nothing)
bmp.Lock()
Dim decoded As Boolean = media.Video.TryReadFrameToPointer(TimeSpan.FromMinutes(1), bmp.BackBuffer, bmp.BackBufferStride)
If decoded Then
bmp.AddDirtyRect(New Int32Rect(0, 0, media.Video.Info.FrameSize.Width, media.Video.Info.FrameSize.Height))
End If
bmp.Unlock()
imageBox.Source = bmp
You can also convert ImageData
to a byte array:
Dim data() As Byte = media.Video.ReadNextFrame().Data.ToArray()
I'm working with
I just downloaded/installed FFMediatoolkit and got this error message directly within my editor.
I guess using VB# is the problem since you guys use C#.
Any suggestions?