.. _Intermediate/SettingTheCompressionQuality:

Setting the Compression Quality when Encoding a Movie Clip
==========================================================

Problem
-------

You want to set the compression quality when encoding a movie clip.

Solution
--------

There are two ways of setting the compression quality when encoding a movie. The first way is to specify the bit rate of the encoder. The bit rate is typically measure in kilobits so the parameter to set is ``kbitRate``::

    encoder = Draft.VideoEncoder( '//path/to/video/save.mov', kbitRate = 85 )

The other way to set the compression quality is with the ``quality`` keyword::

    encoder =  Draft.VideoEncoder( '//path/to/video/save.mov', quality = 80 )

Discussion
----------

The compression ``quality`` parameter is an integer value between 0 and 100. Greater values correspond to higher quality. When using a specified quality Draft will vary the bitrate to maintain the desired quality. This works in most instances.

Specifying the bitrate provides a lot of control, but is only recommended if you the specific bitrate your movie needs to be. ``kbitRate`` is more dependent on the codec than ``quality``. For example, Avid DNxHD\ |reg| accepts only certain kbitRate values. On the other hand H.264 accepts almost any value for ``kbitRate`` but issues arise with very low and very high values. If you don't need to use a specific bitrate then use the ``quality`` keyword and let Draft do the work for you.

These two settings are exclusive and only one of ``quality`` or ``kbitRate`` can be specified.

See Also
--------

:class:`Draft.VideoEncoder`

.. |reg|    unicode:: U+000AE .. REGISTERED SIGN
