user: Show practical ways to work with Encoding in a Blender add-on or script – include code.

assistant: [image reference removed]

Encoding panel.

Here you choose which video container, codec, and compression settings you want to use.
With all of these compression choices, there is a trade-off between file size,
compatibility across platforms, and playback quality.
In the header, you can use the presets, which choose optimum settings for you for that type of output.

Container
:   Video container or file type. For a list of all available options, see
    [video formats](../../../files/media/video_formats.xhtml).

Autosplit Output
:   If your video is huge and exceeds 2GiB, enable Autosplit Output.
    This will automatically split the output into multiple files after the first file is 2GiB in size.

### Video

Video Codec
:   Chooses the method of compression and encoding.
    For a list of all available options see [video formats](../../../files/media/video_formats.xhtml).

Color Depth
:   The exponent value (with base two) for how many colors can be represented within a single color channel.
    A higher bit depth will allow more possible colors, reducing banding, and increasing precision.
    Yet a higher bit depth will increase memory usage exponentially.

    Note, not all file formats support every color depth configuration.

    8:
    :   Allows 256 levels per channel, resulting in approximately 16.7 million total colors (RGB).
        This is the most common format for on-screen graphics and standard video.

    10:
    :   Allows 1,024 levels per channel, resulting in over 1 billion total colors (RGB).

        *Available for H.264, H.265, and AV1 codecs.*

    12:
    :   Allows 4,096 levels per channel, resulting in over 68 billion total colors (RGB).

        *Available for H.265 and AV1 codecs.*

Profile ProRes
:   Determines the quality, compression, and data rate of the encoded video.

    ProRes 422 Proxy:
    :   Lowest data rate and quality.
        Useful for offline editing or situations where storage and speed are critical.

    ProRes 422 LT:
    :   Lower data rate than standard ProRes 422 with reasonable quality.
        Suitable for editing and draft reviews.

    ProRes 422:
    :   Standard quality with good balance between image fidelity and file size.
        Recommended for general workflows.

    ProRes 422 HQ:
    :   Higher quality and data rate than standard ProRes 422.
        Preferred for broadcast and high-end post-production.

    ProRes 4444:
    :   Supports full-resolution RGB and alpha channels.
        Suitable for compositing and visual effects pipelines.

    ProRes 4444 XQ:
    :   Highest quality ProRes format.
        Maintains maximum color detail and dynamic range, ideal for color grading and VFX.

Output Quality
:   These are preset [Rate](#rate).

Encoding Speed
:   Presets to change between a fast encode (bigger file size) and more compression (smaller file size).

Keyframe Interval
:   The number of pictures per [Group of Pictures](https://en.wikipedia.org/wiki/Group_of_pictures).
    Set to 0 for “intra_only”, which disables [inter-frame](https://en.wikipedia.org/wiki/Inter-frame) video.
    A higher number generally leads to a smaller file but needs a higher-powered device to replay it.

Max B-frames
:   Enables the use of [B-frames](../../../glossary/index.xhtml#term-Frame-Types).

    Interval
    :   The maximum number of [B-frames](../../../glossary/index.xhtml#term-Frame-Types) between non-B-frames.

#### Rate

Bitrate
:   Sets the average [bit rate](https://en.wikipedia.org/wiki/Bit_rate) (quality),
    which is the count of binary digits per frame.
    See also: [FFmpeg -b:v](https://ffmpeg.org/ffmpeg.html#Description).

Minimum / Maximum
:   Video files can use what is called variable bit rate (VBR).
    This is used to give some segments of the video less compressing to frames that need more data
    and less to frames with less data. This can be controlled by the *Minimum* and *Maximum* values.

Buffer
:   The [decoder bitstream buffer](https://en.wikipedia.org/wiki/Video_buffering_verifier) size.

Mux Rate
:   Maximum bit rate of the multiplexed stream.
    [Multiplexing](https://www.afterdawn.com/glossary/term.cfm/multiplexing)
    is the process of combining separate video and audio streams into a single file,
    similar to packing a video file and MP3 audio file in a zip-file.

Mux Packet Size
:   Reduces data fragmentation or muxer overhead depending on the source.

### Audio

These settings change how sound is exported while rendering.
To control how sound is played back from within Blender, see the audio settings
in the [Preferences](../../../editors/preferences/system.xhtml#prefs-system-sound).

Audio Codec
:   Audio format to use. For a list of all available options, see
    [video formats](../../../files/media/video_formats.xhtml).

Audio Channels
:   The number of audio source “locations” to encode.

    Mono:
    :   Output a single audio channel.

    Stereo:
    :   Output two audio channels; typically a left and right channel.

    4 Channels:
    :   Output a four audio channels.

    5.1 Surround:
    :   Output a five audio channels with one LFE channel.

    7.1 Surround:
    :   Output a seven audio channels with one LFE channel.

Sample Rate
:   Sets the audio [sampling rate](https://en.wikipedia.org/wiki/Sampling_(signal_processing)#Sampling_rate).

Bitrate
:   For each codec, you can control the bit rate (quality) of the sound in the movie.
    Higher bit rates are bigger files that stream worse but sound better.
    Use powers of 2 for compatibility.

Volume
:   Sets the output volume of the audio.

### Tips