Javacv: java2DFrameConverter used by multiple threads to get BufferedImages

Created on 6 Apr 2020  路  4Comments  路  Source: bytedeco/javacv

Hi,

I am using FFmpegFrameGrabber to grab frames from video, then convert them to BufferedImage using java2DFrameConverter. This converter seems to save all Frames converted to BufferedImages to same BufferedImages object. As result, different threads using FFmpegFrameGrabbers with java2DFrameConverter overwrite each other's images. My quetion is - is there any "good" way to prevent this from happening or do I need to synchronize threads using something like semaphore and copy BufferedImages to separate objects, which would result in some threads being blocked? (for example some way to convert frame to bufferedImage that would not save them all to same object)

Will be thankful for any ideas.

question

All 4 comments

The idea is to use one instance per thread. Sounds good?

Thanks for answer. Do you mean single instance of java2DFrameConverter?

No, multiple instances.

Sorry, I meant one instance of java2DFrameConverter per thread. Thanks for anwers, will test it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nghiepvth picture nghiepvth  路  3Comments

fif10 picture fif10  路  3Comments

UpAndDownAgain picture UpAndDownAgain  路  3Comments

The-Crocop picture The-Crocop  路  5Comments

Maleandr picture Maleandr  路  3Comments