I was initially using the VideoFileReader to incrementally extract frames into Bitmaps for the purpose of analyzing extracted images. It's been suggested by another coder that extracting BitmapData could be much faster. However, I am unable to find anything on sample code or implementation other than basic formatting information. Based on the online documentation, I have attempted the following code and am only getting empty BitmapData objects.
Just for reference, the purpose of the code in question is to analyze a tv episode video file and detect commercial breaks based on analyzing a grid of pixels over each frame, looking for a sudden drop in brightness (fade out/fade ins around commercials). So far I have been extracting Bitmaps and then using GetPixel to analyze a 10x10 grid of pixels over each frame. It's fairly quick but not quite quick enough. A 30 minute video takes almost a minute to process, and that's at very low resolution (640x480). So if there is a different solution that could work better to detect any fade to black areas of a video I am open to suggestions. One thing I would prefer would be if I could not only detect fade outs but confirm them by checking audio levels as well, as these fade outs are silent as well.
Also keep in mind that I am only sampling a 10x10 grid of pixels, since I find no need to scan every single one due to reduncancy. This means that I don't require the images to be high quality, if they were thumbnail sized the results would basically be the same. If there was a way to just directly probe specific pixels per frame to speed things up I would be open to that too.
With that said, this is the code I currently have which gives me nothing, regardless of what frame index I enter.
` //Create empty BitmapData object BitmapData videoFrameData = new BitmapData();
//Extract frame #1000 into new object reader.ReadVideoFrame(1000, videoFrameData);`
I attempted the code posted above and the BitmapData object returns empty.