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))
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)
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
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
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()
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()