1
VideoFrameReader.Read frames using multicore processor
Question asked by Mark Sugrue - 1/6/2021 at 4:57 AM
Unanswered
I'm new to VideoUltimate so maybe I've missed something obvious on this. What I want to do is use VideoFrameReader to decode a video file access pixel data from every frame to run analytics. I'd like to do this as fast as possible.

FFmpeg can spread processing across multiple CPU cores, but when I try videoFrameReader.Read() it seems max out a single CPU core and leave the other idle. Is there a way to use the full CPU resources more efficiently when decoding frames?

This is my code snippet.

using (var videoFrameReader = new VideoFrameReader(file))
{
                if (videoFrameReader.Read()) //Only if frame was read successfully
                {
                    int i = 0;
                    foreach (var f in videoFrameReader)
                    {
                        string filename = @"D:\video\temp\Frame" + i++ +".jpg";
                        f.Save(filename, ImageFormat.Jpeg);
                        f.Dispose();
                    }
                }
            }

Reply to Thread