How can I playback and save selected raw video frames from raw video data (in .rgb or .raw).
Raw uncompressed video data is 320 x 240 in grayscale format with 1 byte/pixel and just 30 fps.
But how can I view multiple the frames in 30 FPS? Can I use DirectShow or a similar API? And what is the best resource to get started? I looked at FFPMEG but I want to avoid showing compressed frames as this it is for scientific application.
So far I have been able to view one frame from a raw video data (in .rgb) using this code in C# .NET for Win Forms using a Picture Box control. But not sure how to do multiple frames and perhaps have a seeking control.
byte[] imageData = File.ReadAllBytes("output.rgb");
Console.WriteLine("imageDataLen=" + imageData.Length);
int width = 320;
int height = 240;
var bmp = new Bitmap(width, height, PixelFormat.Format8bppIndexed);
//bmp = (Bitmap) ConvertToGrayScale(bmp);
ColorPalette pal = bmp.Palette;
for (int i = 0; i <= 255; i++)
{
// create greyscale color table
pal.Entries[i] = Color.FromArgb(i, i, i);
}
bmp.Palette = pal;
BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0,
bmp.Width,
bmp.Height),
ImageLockMode.WriteOnly,
bmp.PixelFormat);
Marshal.Copy(imageData, 0, bmpData.Scan0, width * height);
bmp.UnlockBits(bmpData);
pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
pictureBox1.Image = bmp;