VedioCapture encountered an API version issue when reading video files

Yes 。So I changed my wording to: while(capture.read(mat))。Now,is working