Ejemplo n.º 1
0
 def __init__(self, name='mjpeg'):
   super(MotionJpegCodec, self).__init__(name)
   self.codecname = 'mjpeg'
   self.extension = 'mjpeg'
   self.option_set = encoder.OptionSet(
     encoder.IntegerOption('qmin', 1, 69),
     encoder.IntegerOption('qmax', 2, 1024),
   )
Ejemplo n.º 2
0
 def __init__(self, name='vp9'):
     super(Vp9Codec, self).__init__(name)
     self.extension = 'webm'
     self.option_set = encoder.OptionSet(
         encoder.IntegerOption('cpu-used', 0, 16),
         # The "best" option gives encodes that are too slow to be useful.
         encoder.ChoiceOption(['good', 'rt']).Mandatory(),
         encoder.IntegerOption('passes', 1, 2),
     )
Ejemplo n.º 3
0
 def __init__(self, name='vp8-mpeg'):
     super(Vp8CodecMpegMode, self).__init__(name)
     # Set the parts that are different from the VP8 codec.
     self.option_set = encoder.OptionSet(
         encoder.IntegerOption('fixed-q', 0, 63).Mandatory(),
         encoder.IntegerOption('gold-q', 0, 63).Mandatory(),
         encoder.IntegerOption('key-q', 0, 63).Mandatory(),
         encoder.ChoiceOption(['good', 'best', 'rt']),
     )
     # The start encoder is exactly the same as for VP8,
     # except that fixed-q, gold-q, alt-q and key-q parameters are set.
     # TODO(hta): Remove the options that have no effect in this mode.
     self.start_encoder_parameters = """ --lag-in-frames=0 \
Ejemplo n.º 4
0
 def __init__(self, name='vp8'):
     super(Vp8Codec, self).__init__(name)
     self.extension = 'webm'
     self.option_set = encoder.OptionSet(
         encoder.Option('overshoot-pct', ['0', '15', '30', '45']),
         encoder.Option('undershoot-pct', ['0', '25', '50', '75', '100']),
         # CQ mode is not considered for end-usage at the moment.
         encoder.Option('end-usage', ['cbr', 'vbr']),
         # End-usage cq doesn't really make sense unless we also set q to something
         # between min and max. This is being checked.
         # encoder.Option('end-usage', ['cbr', 'vbr', 'cq']),
         encoder.Option('end-usage', ['cbr', 'vbr']),
         encoder.Option('min-q', ['0', '2', '4', '8', '16', '24']),
         encoder.Option('max-q', ['32', '56', '63']),
         encoder.Option(
             'buf-sz',
             ['200', '500', '1000', '2000', '4000', '8000', '16000']),
         encoder.Option(
             'buf-initial-sz',
             ['200', '400', '800', '1000', '2000', '4000', '8000', '16000'
              ]),
         encoder.Option('max-intra-rate',
                        ['100', '200', '400', '600', '800', '1200']),
         encoder.ChoiceOption(['good', 'best', 'rt']),
         encoder.IntegerOption('cpu-used', -16, 16),
     )
Ejemplo n.º 5
0
 def __init__(self, name='x264', formatter=None):
     super(X264Codec, self).__init__(
         name,
         formatter=(formatter
                    or encoder.OptionFormatter(prefix='--', infix=' ')))
     self.extension = 'mkv'
     self.option_set = encoder.OptionSet(
         encoder.Option('preset', [
             'ultrafast', 'superfast', 'veryfast', 'faster', 'fast',
             'medium', 'slow', 'slower', 'veryslow', 'placebo'
         ]),
         encoder.Option('rc-lookahead', ['0', '30', '60']),
         encoder.Option('vbv-init', ['0.5', '0.8', '0.9']),
         encoder.Option('ref', ['1', '2', '3', '16']),
         encoder.ChoiceOption(['use-vbv-maxrate']),
         encoder.Option('profile', ['baseline', 'main', 'high']),
         encoder.Option('tune', ['psnr', 'ssim']),
         # Experimentation on a 6-core, 12-thread system shows some gains on
         # large videos for thread values up to the thread count, and up to the
         # core count on smaller videos.
         # There is some damage to PSNR with more threads.
         encoder.IntegerOption('threads', 1, 6).Mandatory(),
         encoder.DummyOption('vbv-maxrate'),
         encoder.DummyOption('vbv-bufsize'),
     )
Ejemplo n.º 6
0
 def __init__(self):
     super(DummyCodec, self).__init__('dummy')
     self.extension = 'fake'
     self.option_set = encoder.OptionSet(
         encoder.IntegerOption('score', 0, 10),
         encoder.Option('another_parameter', ['yes']),
     )
Ejemplo n.º 7
0
 def __init__(self, name='vp8-mp1'):
     super(Vp8CodecMpeg1dMode, self).__init__(name)
     # Set the parts that are different from the VP8 MPEG codec.
     self.option_set = encoder.OptionSet(
         encoder.IntegerOption('key-q', 0, 63).Mandatory(),
         encoder.DummyOption('fixed-q'),
         encoder.DummyOption('gold-q'),
     )
Ejemplo n.º 8
0
 def test_OptionValues(self):
     codec = DummyCodec()
     my_encoder = encoder.Encoder(
         encoder.Context(codec),
         encoder.OptionValueSet(
             encoder.OptionSet(encoder.IntegerOption('score', 0, 100)),
             '--score=77'))
     self.assertEqual(repr(my_encoder.OptionValues()), "{'score': '77'}")
     self.assertEqual(my_encoder.DisplayValues(), '77')
 def __init__(self):
   super(Vp8CodecMpeg1dMode, self).__init__()
   # Set the parts that are different from the VP8 codec.
   self.name = 'vp8-mp1'
   self.options = [
     encoder.IntegerOption('key-q', 0, 63),
     ]
   self.start_encoder = encoder.Encoder(self,
     self.ConfigurationFixups(self.start_encoder.parameters))
Ejemplo n.º 10
0
 def __init__(self):
     super(Vp8CodecMpegMode, self).__init__()
     # Set the parts that are different from the VP8 codec.
     self.name = 'vp8-mpeg'
     self.options = [
         encoder.IntegerOption('fixed-q', 0, 63),
         encoder.IntegerOption('gold-q', 0, 63),
         encoder.IntegerOption('key-q', 0, 63),
         encoder.ChoiceOption(['good', 'best', 'rt']),
     ]
     # The start encoder is exactly the same as for VP8,
     # except that min-q and max-q have the same value.
     # TODO(hta): Remove the options that have no effect in this mode.
     self.start_encoder = encoder.Encoder(
         self, """ --lag-in-frames=0 \
   --kf-min-dist=3000 \
   --kf-max-dist=3000 --cpu-used=0 --static-thresh=0 \
   --token-parts=1 --drop-frame=0 --end-usage=cbr \
   --fixed-q=32 --gold-q=30 --alt-q=31 --key-q=28 \
   --undershoot-pct=100 --overshoot-pct=15 --buf-sz=1000 \
   --buf-initial-sz=800 --buf-optimal-sz=1000 --max-intra-rate=1200 \
   --resize-allowed=0 --passes=1 --best --noise-sensitivity=0 """)
Ejemplo n.º 11
0
 def test_IntegerOption(self):
     option = encoder.IntegerOption('foo', 5, 6)
     self.assertTrue(str(6) in option.values)
     self.assertFalse(str(4) in option.values)