I use following GStreamer pipeline with VideoCapture class.
filesrc location=video.webm ! matroskademux ! vp9dec ! videoconvert ! appsink
Now VideoCapture::get(cv::CAP_PROP_FRAME_COUNT) returns the correct frame count, but when reading frames in loop with VideoCapture::read, less frames are got before EOF (return value false).