I am trying to loop over a directory of sub folders where every folder contains one .avi file that i want to retrieve its length in seconds.
I\'ve found PyMedia
Not sure if there is a platform independent way to do this, but if you only need this to work on windows then it looks like MediaInfo (below) has a command line interface which you can use to output details about video files, which could then be parsed to get the information. Not the prettiest solution but looks like it should work.
http://mediainfo.sourceforge.net/en