Alex Kievsky
Alex Kievsky

Reputation: 114

QTMovie addImage performance

I'm working on desktop video capture. I implemented screenshot grabbing which works fast. Then I add every screenshot to QTMovie via addImage:forDuration:withAttributes: but it works very slow, so when I'm trying to create fullscreen capture (1920x1080 for example) I have only 1.2 fps. I tried to collect screenshots on main thread and process them (add to QTMovie) on other thread and I get very fast growing of memory consumption (retrieved screenshots are uncompressed). Any ideas? Thanks.

Upvotes: 1

Views: 421

Answers (1)

Davyd Geyl
Davyd Geyl

Reputation: 4623

I agree addImage:forDuration:withAttributes: is not a good method for frame by frame capture. We have also experienced memory leaks inside QTKit framework when used it for capture with a lot of frames.

Much better results can be achieved by using Quicktime framework. In particular AddMediaSample2() function to add images to the movie.

You need to be careful if you use one thread to get the frames and another thread to add the data to the movie. You can come to the point when you have a lot of frames very quickly, but your objects cannot add all them to the movie with the same speed. To keep going you may need to drop certain frames.

Generally, capture is a tricky process. Good luck.

Upvotes: 3

Related Questions