How to find QMediaPlayer Video Resolution and Aspect Ratio
This seems too simple, I must be overlooking something?
How do I find the native video size or aspect ratio from a video file being displayed by a QMediaPlayer?
The video Resolution, PixelAspectRatio, etc., should be in the MetaData, but I wait for MetaData Update Signals, and wait for seconds after the video .play()s, but isMetaDataAvailable() always returns false, and .availableMetaData() and .metaData(QMediaMetaData::Resolution).toSize() always return empty.
There seems to be nowhere else to get the video resolution information, or am I missing something?
I can open the video, play the video at full screen, etc.
I tried the suggestion from andreyc using QMediaPlayer::media() - which did not work. The QMediaResources had information like URL (localFile name), but the resolution data returned 0 (unknown).
I did find an answer at http://forum.qt.io/topic/31278/solved-get-resolution-of-a-video-file-40-qmediaplayer-41/2, using QGraphicsVideoItems class property: nativeSize after the video started playing. (Note here - need to wait for the video to actually load & play after calling QMediaPlayer::play(). )