def _data_rate(self): """Return data rate (bit rate).""" if self._stream_type() not in ['video', 'audio']: raise SkipElementException() if self._mediainfo is None: return None if self._mediainfo_stream.bit_rate is not None: if self._mediainfo_stream.track_type == 'Video': return strip_zeros( str(float(self._mediainfo_stream.bit_rate) / 1000000)) return strip_zeros( str(float(self._mediainfo_stream.bit_rate) / 1000)) return '(:unav)'
def _codec_quality(self): """ Return codec quality. Must be resolved, if returns None. Only values 'lossy' or 'lossless' are allowed. """ if self._stream_type() not in ['video', 'audio']: raise SkipElementException() if self._mediainfo is None: return None if self._mediainfo_stream.compression_mode is not None: return self._mediainfo_stream.compression_mode.lower() return None
def _data_rate_mode(self): """ Return data rate mode. Must be resolved, if returns None. The allowed values are 'Fixed' and 'Variable'. """ if self._stream_type() not in ['video', 'audio']: raise SkipElementException() if self._mediainfo is None: return None if self._mediainfo_stream.bit_rate_mode == 'CBR': return 'Fixed' if self._mediainfo_stream.bit_rate_mode is not None: return 'Variable' return None
def _color(self): """ Return color information. Only values from fixed list are allowed. Must be resolved, if returns None. """ if self._stream_type() not in ['video']: raise SkipElementException() if self._ffmpeg is None: return None if 'pix_fmt' in self._ffmpeg_stream: if self._ffmpeg_stream["pix_fmt"] in ["gray"]: return "Grayscale" if self._ffmpeg_stream["pix_fmt"] in ["monob", "monow"]: return "B&W" return 'Color' return None
def _color(self): """ Return color information. Only values from fixed list are allowed. Must be resolved, if returns None. """ if self._stream_type() not in ['video']: raise SkipElementException() if self._mediainfo is None: return None if self._mediainfo_stream.color_space is not None: if self._mediainfo_stream.color_space in ['RGB', 'YUV']: return 'Color' if self._mediainfo_stream.color_space in ['Y']: return 'Grayscale' if self._mediainfo_stream.chroma_subsampling is not None: return 'Color' return None
def _codec_quality(self): """Returns codec quality.""" if self._stream_type() == 'audio': return 'lossless' raise SkipElementException()