Skip to content

muxtools.helpers.bsf.bsf_hevc_avc

apply_avc_bsf

apply_avc_bsf(fileIn: PathLike, fileOut: Path | None = None, sar: Literal[1] | Fraction | str | None = None, cloc_type: BSF_ChromaLocation | int | None = None, full_range: bool | int | None = None, format: BSF_Format | int | None = None, primaries: BSF_Primaries | int | None = None, transfer: BSF_Transfer | int | None = None, matrix: BSF_Matrix | int | None = None, crop: int | tuple[int, int] | tuple[int, int, int, int] | None = None, quiet: bool = True, **kwargs: bool | str) -> Path

A helper for the FFMpeg h264_metadata bitstream filter.

None values will do nothing to the respective metadata flags.

Parameters:

Name Type Description Default
fileIn PathLike

The file to modify

required
sar Literal[1] | Fraction | str | None

Set the sample aspect ratio in the stream

None
cloc_type BSF_ChromaLocation | int | None

Set the chroma sample location in the stream

None
full_range bool | int | None

Set the full range flag in the stream

None
format BSF_Format | int | None

Set the video format in the stream

None
primaries BSF_Primaries | int | None

Set the color primaries in the stream

None
transfer BSF_Transfer | int | None

Set the transfer characteristics in the stream

None
matrix BSF_Matrix | int | None

Set the matrix coefficients in the stream

None
crop int | tuple[int, int] | tuple[int, int, int, int] | None

Set the crop values in the stream

None
quiet bool

Suppresses the output of ffmpeg

True
kwargs bool | str

Additional options for the filter.

For other available options, check the hyperlink to the filter above.

{}

Returns:

Type Description
Path

The output path which may be different if a CRC was detected and swapped.

Source code in muxtools/helpers/bsf/bsf_hevc_avc.py
def apply_avc_bsf(
    fileIn: PathLike,
    fileOut: Path | None = None,
    sar: Literal[1] | Fraction | str | None = None,
    cloc_type: BSF_ChromaLocation | int | None = None,
    full_range: bool | int | None = None,
    format: BSF_Format | int | None = None,
    primaries: BSF_Primaries | int | None = None,
    transfer: BSF_Transfer | int | None = None,
    matrix: BSF_Matrix | int | None = None,
    crop: int | tuple[int, int] | tuple[int, int, int, int] | None = None,
    quiet: bool = True,
    **kwargs: bool | str,
) -> Path:
    """
    A helper for the FFMpeg [h264_metadata](https://ffmpeg.org/ffmpeg-bitstream-filters.html#h264_005fmetadata) bitstream filter.

    `None` values will do nothing to the respective metadata flags.

    :param fileIn:                      The file to modify
    :param fileOut                      Optional output path override
    :param sar:                         Set the sample aspect ratio in the stream
    :param cloc_type:                   Set the chroma sample location in the stream
    :param full_range:                  Set the full range flag in the stream
    :param format:                      Set the video format in the stream
    :param primaries:                   Set the color primaries in the stream
    :param transfer:                    Set the transfer characteristics in the stream
    :param matrix:                      Set the matrix coefficients in the stream
    :param crop:                        Set the crop values in the stream
    :param quiet:                       Suppresses the output of ffmpeg
    :param kwargs:                      Additional options for the filter.\n
                                        For other available options, check the hyperlink to the filter above.
    :return:                            The output path which may be different if a CRC was detected and swapped.
    """

    return _apply_avc_hevc_bsf(
        fileIn,
        fileOut,
        "h264_metadata",
        sar=sar,
        cloc_type=cloc_type,
        full_range=full_range,
        format=format,
        primaries=primaries,
        transfer=transfer,
        matrix=matrix,
        crop=crop,
        quiet=quiet,
        caller=apply_avc_bsf,
        **kwargs,
    )

apply_hevc_bsf

apply_hevc_bsf(fileIn: PathLike, fileOut: Path | None = None, sar: Literal[1] | Fraction | str | None = None, cloc_type: BSF_ChromaLocation | int | None = None, full_range: bool | int | None = None, format: BSF_Format | int | None = None, primaries: BSF_Primaries | int | None = None, transfer: BSF_Transfer | int | None = None, matrix: BSF_Matrix | int | None = None, crop: int | tuple[int, int] | tuple[int, int, int, int] | None = None, quiet: bool = True, **kwargs: bool | str) -> Path

A helper for the FFMpeg hevc_metadata bitstream filter.

None values will do nothing to the respective metadata flags.

Parameters:

Name Type Description Default
fileIn PathLike

The file to modify

required
sar Literal[1] | Fraction | str | None

Set the sample aspect ratio in the stream

None
cloc_type BSF_ChromaLocation | int | None

Set the chroma sample location in the stream

None
full_range bool | int | None

Set the full range flag in the stream

None
format BSF_Format | int | None

Set the video format in the stream

None
primaries BSF_Primaries | int | None

Set the color primaries in the stream

None
transfer BSF_Transfer | int | None

Set the transfer characteristics in the stream

None
matrix BSF_Matrix | int | None

Set the matrix coefficients in the stream

None
crop int | tuple[int, int] | tuple[int, int, int, int] | None

Set the crop values in the stream

None
quiet bool

Suppresses the output of ffmpeg

True
kwargs bool | str

Additional options for the filter.

For available options, check the hyperlink to the filter above.

{}

Returns:

Type Description
Path

The output path which may be different if a CRC was detected and swapped.

Source code in muxtools/helpers/bsf/bsf_hevc_avc.py
def apply_hevc_bsf(
    fileIn: PathLike,
    fileOut: Path | None = None,
    sar: Literal[1] | Fraction | str | None = None,
    cloc_type: BSF_ChromaLocation | int | None = None,
    full_range: bool | int | None = None,
    format: BSF_Format | int | None = None,
    primaries: BSF_Primaries | int | None = None,
    transfer: BSF_Transfer | int | None = None,
    matrix: BSF_Matrix | int | None = None,
    crop: int | tuple[int, int] | tuple[int, int, int, int] | None = None,
    quiet: bool = True,
    **kwargs: bool | str,
) -> Path:
    """
    A helper for the FFMpeg [hevc_metadata](https://ffmpeg.org/ffmpeg-bitstream-filters.html#hevc_005fmetadata) bitstream filter.

    `None` values will do nothing to the respective metadata flags.

    :param fileIn:                      The file to modify
    :param fileOut                      Optional output path override
    :param sar:                         Set the sample aspect ratio in the stream
    :param cloc_type:                   Set the chroma sample location in the stream
    :param full_range:                  Set the full range flag in the stream
    :param format:                      Set the video format in the stream
    :param primaries:                   Set the color primaries in the stream
    :param transfer:                    Set the transfer characteristics in the stream
    :param matrix:                      Set the matrix coefficients in the stream
    :param crop:                        Set the crop values in the stream
    :param quiet:                       Suppresses the output of ffmpeg
    :param kwargs:                      Additional options for the filter.\n
                                        For available options, check the hyperlink to the filter above.
    :return:                            The output path which may be different if a CRC was detected and swapped.
    """

    return _apply_avc_hevc_bsf(
        fileIn,
        fileOut,
        "hevc_metadata",
        sar=sar,
        cloc_type=cloc_type,
        full_range=full_range,
        format=format,
        primaries=primaries,
        transfer=transfer,
        matrix=matrix,
        crop=crop,
        quiet=quiet,
        caller=apply_hevc_bsf,
        **kwargs,
    )