Ejemplo n.º 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))
 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))
Ejemplo n.º 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)
Ejemplo n.º 4
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)
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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()
Ejemplo n.º 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()