jdr#13464
Hi Everybody,
I'm an absolute newby here, but have searched around and found nothing to solve this problem. Apologies if I've missed something obvious.
At the moment, I am simply trying to load a video and read it frame by frame. There are several examples of this, and I've copied and pasted. The files seem to load (i.e., no exception is thrown), but then the FrameCount in the Reader is always -1. I've tried this with wmv, mov, and other files.
Here is the smallest sample of code (adapted from the Aurigma documentation):
String fileName = null;
openFileDialog.Filter = "Windows Media Files|*.wmv";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
fileName = openFileDialog.FileName;
}
try
{
//Create the reader
IFormatReader reader = MediaFormatManager.CreateFormatReader(fileName);
//Get the frame
if (reader.FrameCount < 1)
{
Console.WriteLine("File contains no frames.");
return;
}
etc., etc.
Debugging, CreateFormatReader has no problem, but when it gets to check reader.FrameCount, it comes back as -1.
I should say that I'm using Windows 7 64 bit. I've been able to run the BitmapViewer sample, and it's compiling and running without problem. I've also used a number of videos, and they all come back with the same problem.
Any help would be greatly appreciated.
Many thanks in advance,
Jon R
I'm an absolute newby here, but have searched around and found nothing to solve this problem. Apologies if I've missed something obvious.
At the moment, I am simply trying to load a video and read it frame by frame. There are several examples of this, and I've copied and pasted. The files seem to load (i.e., no exception is thrown), but then the FrameCount in the Reader is always -1. I've tried this with wmv, mov, and other files.
Here is the smallest sample of code (adapted from the Aurigma documentation):
String fileName = null;
openFileDialog.Filter = "Windows Media Files|*.wmv";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
fileName = openFileDialog.FileName;
}
try
{
//Create the reader
IFormatReader reader = MediaFormatManager.CreateFormatReader(fileName);
//Get the frame
if (reader.FrameCount < 1)
{
Console.WriteLine("File contains no frames.");
return;
}
etc., etc.
Debugging, CreateFormatReader has no problem, but when it gets to check reader.FrameCount, it comes back as -1.
I should say that I'm using Windows 7 64 bit. I've been able to run the BitmapViewer sample, and it's compiling and running without problem. I've also used a number of videos, and they all come back with the same problem.
Any help would be greatly appreciated.
Many thanks in advance,
Jon R