You can try using mediainfo from python. It has a command line option and it is very easy to parse the output, so practically your python module which uses media-info will be sufficient. It has a further advantage because eventually, you will find all media-info type software doesn't support all codecs/format so you can use multiple software/libs under the hood with single python wrapper.