Since FFmpegFrameGrabber.grab() stores new images in the memory address for the previously returned frame. Is there a way to grab images from multiple streams at the same time?
Sure, just use multiple instances of FFmpegFrameGrabber.
I already tried that and it didn't work because the .grab() method stores "the new image in the memory address for the previously returned frame". Which means that multiple instances of FFmpegFrameGrabber would still overwrite each other because they would be writing to the same memory address.
http://bytedeco.org/javacv/apidocs/org/bytedeco/javacv/FFmpegFrameGrabber.html#grab--
"This means that if you need to cache images returned from grab you should Frame.clone() the returned frame as the next call to grab will overwrite your existing image's memory."
I've been trying to save images using Frame.clone() but haven't got it to work. If someone could provide an example, I would appreciate it!
Each instance of FFmpegFrameGrabber is independent. That can't happen.
So every time I create a new FFmpegFrameGrabber object and call .grab(), all FFmpegFrameGrabber objects will use a different memory address?
Yes, that's the idea, right? Could you explain what the issue is in more detail?
After a couple of hours of going through my code line by line, I finally found my issue. I was using a Java2DFrameConverter to convert Frames to BufferedImages and it was set to static. Thanks for the help @saudet!
Most helpful comment
After a couple of hours of going through my code line by line, I finally found my issue. I was using a Java2DFrameConverter to convert Frames to BufferedImages and it was set to static. Thanks for the help @saudet!