Exemple #1
0
 def __init__(self, filename):
   super(VideoInfo, self).__init__(filename)
   self._videoStreams = []
   self._audioStreams = []
   self._subtitleStreams = []
   self._chapters = []
   self._isPending = None
   if not isVideo(self._path):
     raise ValueError('File %s is not a valid video file' % self._path)
   self._tracks = MediaInfo.parse(os.path.join(self._path)).to_data()['tracks']
   for track in self._tracks:
     if track['track_type'] == 'General':
       self._container = track.get('codec', '')
       self._duration = track.get('duration', '')
     elif track['track_type'] == 'Video':
       self._videoStreams.append(track)
     elif track['track_type'] == 'Audio':
       self._audioStreams.append(track)
     elif track['track_type'] == 'Menu' and track.get('chapters_pos_begin', None) is not None:
       self._chapters.append(track)