You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When decoding with FFMediaToolkit there is only 86 resulting images. It claims to be reaching the end of stream before the video is actually completed. When viewing the images they also seem to stop early without all the images.
using System;
using System.Drawing;
using System.IO;
namespace Decode
{
internal static class Program
{
public static unsafe Bitmap ToBitmap(this FFMediaToolkit.Graphics.ImageData bitmap)
{
fixed (byte* p = bitmap.Data)
{
return new Bitmap(bitmap.ImageSize.Width, bitmap.ImageSize.Height, bitmap.Stride, System.Drawing.Imaging.PixelFormat.Format24bppRgb, new IntPtr(p));
}
}
static void Main(string[] args)
{
FFMediaToolkit.FFmpegLoader.FFmpegPath = "./ffmpeg/";
string path = @"C:\Users\joshu\Documents\fftest\Rotate Around.MP4";
string directory = Path.GetDirectoryName(path);
using(FFMediaToolkit.Decoding.MediaFile mediaFile = FFMediaToolkit.Decoding.MediaFile.Open(path))
{
int i = 0;
while(mediaFile.Video.TryGetNextFrame(out FFMediaToolkit.Graphics.ImageData data))
{
Bitmap bmp = data.ToBitmap();
bmp.Save(directory + Path.DirectorySeparatorChar + i++.ToString() + ".png");
}
}
}
}
}
Hmm, okay, interesting, I only ask because I thought the issue might be with how the library reads the file when reading both video and audio. To disable this functionality you'd just set the StreamsToLoad property of a MediaOptions instance to MediaMode.Video and pass the instance to the MediaFile constructor.
Not sure this will help, or if this is the exact issue, but its worth a shot.
Decoding a video with ffmpeg.exe results in 101 images and every frame is there. Here's the command I use.
.\ffmpeg.exe -i ".\Rotate Around.MP4" "out-%03d.jpg"
When decoding with FFMediaToolkit there is only 86 resulting images. It claims to be reaching the end of stream before the video is actually completed. When viewing the images they also seem to stop early without all the images.
Here's the video file
https://user-images.githubusercontent.com/16514346/110321321-30226e80-801a-11eb-9f8a-9f7669451127.MP4
This video was originally encoded with FFMediaToolkit and I'm a big fan of the library. Thanks for making it!
The text was updated successfully, but these errors were encountered: