video - How can I read the info of a media file using visual c++? -
is there way read info (fps, bitrate, duration, codecs required, etc.) of media file (avi, mp4, mkv, etc.) on windows using visual studio c++?
i managed play various files (which don't want) using directshow (http://msdn.microsoft.com/en-us/library/windows/desktop/dd389098%28v=vs.85%29.aspx) don't know how information file.
edit: got working this...
int height, width, framerate, bitrate; large_integer duration; // initialize com library coinitialize(null); // ipropertystore* store = null; shgetpropertystorefromparsingname(l"e:\\test.avi", null, gps_default, __uuidof(ipropertystore), (void**)&store); propvariant variant; store->getvalue(pkey_media_duration, &variant); duration = variant.hval; store->getvalue(pkey_video_frameheight, &variant); height = variant.lval; store->getvalue(pkey_video_framewidth, &variant); width = variant.lval; store->getvalue(pkey_video_framerate, &variant); framerate = variant.lval; store->getvalue(pkey_video_totalbitrate, &variant); bitrate = variant.lval; // store->release(); // couninitialize();
you can obtain information via directshow, if don't need playback/streaming pipeline , on windows 7, possibly have better alternate option data shell properties - supplying data display in additional columns of windows explorer.
shgetpropertystorefromparsingname
gets property store- msdn entry point shell metadata providers
- code snippet: how use ipropertystore obtain
media_duration
?
Comments
Post a Comment