コード例 #1
0
 def test_rescale_video(self):
     target = (1024, 768)
     self.assertEqual(utils.rescale_video(target, target),
                      target)
     self.assertEqual(utils.rescale_video((512, 384), target), # small
                      (512, 384))
     self.assertEqual(utils.rescale_video((2048, 1536), target), # big
                      target)
     self.assertEqual(utils.rescale_video((1400, 768), target), # widescreen
                      (1024, 560))
コード例 #2
0
 def test_rescale_video(self):
     target = (1024, 768)
     self.assertEqual(utils.rescale_video(target, target), target)
     self.assertEqual(
         utils.rescale_video((512, 384), target),  # small
         (512, 384))
     self.assertEqual(
         utils.rescale_video((2048, 1536), target),  # big
         target)
     self.assertEqual(
         utils.rescale_video((1400, 768), target,
                             dont_upsize=False),  # widescreen
         (1024, 560))
コード例 #3
0
    def get_target_size(self, video):
        """Get the size that we will convert to for a given video.

        :returns: (width, height) tuple
        """
        return utils.rescale_video((video.width, video.height),
                                   (self.width, self.height),
                                   dont_upsize=self.dont_upsize)
コード例 #4
0
ファイル: converter.py プロジェクト: rulemotion/renew-mvc3
    def get_target_size(self, video):
        """Get the size that we will convert to for a given video.

        :returns: (width, height) tuple
        """
        return utils.rescale_video((video.width, video.height),
                (self.width, self.height),
                dont_upsize=self.dont_upsize)
コード例 #5
0
 def get_extra_arguments(self, video, output):
     arguments = super(SimpleFFmpegConverterInfoWithSize, self).get_extra_arguments(video, output)
     if self.width and self.height:
         width, height = rescale_video(
             (video.width, video.height), (self.width, self.height), dont_upsize=self.dont_upsize
         )
         arguments.extend(("-s", "%ix%i" % (width, height)))
     return arguments
コード例 #6
0
 def get_extra_arguments(self, video, output):
     arguments = super(SimpleFFmpegConverterInfoWithSize,
                       self).get_extra_arguments(video, output)
     if self.width and self.height:
         width, height = rescale_video((video.width, video.height),
                                       (self.width, self.height),
                                       dont_upsize=self.dont_upsize)
         arguments.extend(('-s', '%ix%i' % (width, height)))
     return arguments
コード例 #7
0
 def get_extra_arguments(self, video, output):
     if self.parameters is None:
         raise NotImplementedError
     width, height = utils.rescale_video((video.width, video.height),
                                         (self.width, self.height))
     ssize = '%ix%i' % (width, height)
     return self.parameters.format(
         ssize=ssize,
         input=video.filename,
         output=output).split()
コード例 #8
0
 def get_extra_arguments(self, video, output):
     if self.parameters is None:
         raise NotImplementedError
     width, height = utils.rescale_video((video.width, video.height),
                                         (self.width, self.height),
                                         dont_upsize=self.dont_upsize)
     ssize = '%ix%i' % (width, height)
     return self.parameters.format(ssize=ssize,
                                   input=video.filename,
                                   output=output).split()