コード例 #1
0
 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)'
コード例 #2
0
    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
コード例 #3
0
    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
コード例 #4
0
ファイル: ffmpeg_base.py プロジェクト: rasek-sls/file-scraper
    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
コード例 #5
0
    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
コード例 #6
0
 def _codec_quality(self):
     """Returns codec quality."""
     if self._stream_type() == 'audio':
         return 'lossless'
     raise SkipElementException()