src/pyams_media/ffbase.py
changeset 7 b930c820b6cd
parent 0 fd39db613f8b
child 21 1784464dfe62
equal deleted inserted replaced
6:b78dab193043 7:b930c820b6cd
   149         if IFile.providedBy(input) or isinstance(input, str) or hasattr(input, 'read'):
   149         if IFile.providedBy(input) or isinstance(input, str) or hasattr(input, 'read'):
   150             input = [input, ]
   150             input = [input, ]
   151         for i in range(0, len(input) * 2, 2):
   151         for i in range(0, len(input) * 2, 2):
   152             input.insert(i, "-i")
   152             input.insert(i, "-i")
   153         if self.__ffmpeg__ == 'ffprobe':
   153         if self.__ffmpeg__ == 'ffprobe':
   154             input.extend(['-show_streams', '-print_format', 'json'])
   154             input.extend(['-show_format', '-show_streams', '-print_format', 'json'])
   155             probe = self.__exec__(*input)[0]  # stdout
   155             probe = self.__exec__(*input)[0]  # stdout
   156             metadata.extend(json.loads(probe.decode()).get('streams', []))
   156             metadata = json.loads(probe.decode())
   157         else:
   157         else:
   158             lines = self.__exec__(*input)[1]  # stderr
   158             lines = self.__exec__(*input)[1]  # stderr
   159             for line in lines.split(b'\n'):
   159             for line in lines.split(b'\n'):
   160                 if isinstance(line, bytes):
   160                 if isinstance(line, bytes):
   161                     try:
   161                     try: