Get video file duration without playing it
Solved
General and Desktop
-
Hi,
I have a folder with a few video files (mostly .avi, .mp4). Is there a way to get their duration without playing them? I've tried using QVideoPlayer duartion() method, but it return the correct value only when playing the file. Also, it can only get the duration of one file, while I want to get the duration for multiple values.
Is there a Qt way of doing it? If no, any other solution you recommend?Thanks
-
Thanks. Ended up really using mediainfo, got it with the following method
int getVideoDuration(std::string fileName){ MediaInfo MI; MI.Open(fileName); int duration = std::stoi(MI.Get(Stream_General, 0, "Duration")); MI.Close(); return duration; }