Encoding Methods

Yukine provides a few encoding methods to use with the Source object. By default, it will use EncodingMethod.av1an. However, you can also use EncodingMethod.chunked_encoder to use our own (experimental) chunked encoding system.

EncodingMethod

EncodingMethod is an enum that defines the encoding method to use.

Setting EncodingMethod example
vid1 = Source(
    encoding_method=EncodingMethod.av1an,
)

Available EncodingMethod values

EncodingMethod values

EncodingMethod.av1an

EncodingMethod.chunked_encoder

Using EncodingMethod.chunked_encoder

Using EncodingMethod.chunked_encoder is different from using EncodingMethod.av1an. Rather than passing cli args in a string, you pass a dictionary of the settings you want to use.

Setting EncodingMethod example
vid1 = Source(
    encoding_method=EncodingMethod.chunked_encoder,
    chunked_encoder_settings=ChunkedEncoderSettings(
        console=console, # (1)!
        max_concurrent=4, # (2)!
        chunk_order=ChunkOrder.long_to_short, # (3)!
        resume=True, # (4)!
        load_scenes="new_scenes.json", # (5)!
        min_scene_len=15, # (6)!
        max_scene_len=240, # (7)!
        threshold=3, # (8)!
    ),
)
  1. Rich console

    This is not required, but it’s recommended to use your own Console instance. If you don’t provide one, Yukine use it’s own instance. yukine.log.console

  2. max_concurrent

    This is the maximum number of encodes to run at the same time. Same as Av1an’s --workers option. If you don’t provide one, Yukine will use 4. This is likely to change in the future to be more intelligent.

  3. chunk_order

    This is the order in which the chunks will be encoded. Same as Av1an’s --chunk-order option. If you don’t provide one, Yukine will use ChunkOrder.long_to_short.

  4. resume

    This is whether or not to resume encoding from a previous run. This requires the ChunkedEncoder temp folder to still exist. If you don’t provide one, Yukine will use False.

  5. load_scenes

    This is the path to the scenes file to load. This can be either a ChunkedEncoder scenes file, or an Av1an scenes file. If you don’t provide one, Yukine will run scene detection.

  6. min_scene_len

    This is the minimum length of a scene in frames. If you don’t provide one, Yukine will use 15.

  7. max_scene_len

    This is the maximum length of a scene in frames. If you don’t provide one, Yukine will use 240.

  8. threshold

    This is the threshold for scene detection. Check the PySceneDetect docs for more information. If you don’t provide one, Yukine will use 3.

Regarding EncodingMethod.chunked_encoder:

EncodingMethod.chunked_encoder is very experimental and is only recommended for if you’re Rustphobic or have issues with Av1an.