It's working much faster now, thanks for posting.
Also, the frame coding should be changed from PIX_FMT_RGB32 to PIX_FMT_BGR24.