# Path: mugen/utilities/logger.py

# 
# Path: mugen/utilities/system.py
# def use_temporary_file_fallback(path_var: str, extension: str):
#     """
#     Decorator to set path_var to a temporary file path if it is None. Does not create the file.
# 
#     Parameters
#     ----------
#     path_var
#         A variable expecting a file path
# 
#     extension
#         extension for the temporary file
#     """
# 
#     def _use_temporary_file_path(path_variable):
#         return path_variable or generate_temp_file_path(extension)
# 
#     return preprocess_args(_use_temporary_file_path, [path_var])


import os
from typing import List, Optional, Union
from moviepy.editor import VideoClip
from tqdm import tqdm
from mugen.utilities.logger import logger
from mugen.utilities.system import use_temporary_file_fallback
        video_clip

        output_path

        audio
            Audio for the video clip. Can be True to enable, False to disable, or an external audio file.

        verbose
            Whether output to stdout should include extra information during writing

        show_progress
            Whether to output progress information to stdout

        kwargs
            List of other keyword arguments to pass to moviepy's write_videofile
        """
        # Prepend crf to ffmpeg_params
        ffmpeg_params = ["-crf", str(self.crf)] + self.ffmpeg_params
        audio_bitrate = str(self.audio_bitrate) + "k"

        video_clip.write_videofile(
            output_path,
            audio=audio,
            preset=self.preset,
            codec=self.codec,
            audio_codec=self.audio_codec,
            audio_bitrate=audio_bitrate,
            ffmpeg_params=ffmpeg_params,
            **kwargs,
            verbose=verbose,

# Path: mugen/utilities/logger.py

# 
# Path: mugen/utilities/system.py
# def use_temporary_file_fallback(path_var: str, extension: str):
#     """
#     Decorator to set path_var to a temporary file path if it is None. Does not create the file.
# 
#     Parameters
#     ----------
#     path_var
#         A variable expecting a file path
# 
#     extension
#         extension for the temporary file
#     """
# 
#     def _use_temporary_file_path(path_variable):
#         return path_variable or generate_temp_file_path(extension)
# 
#     return preprocess_args(_use_temporary_file_path, [path_var])


# Path: mugen/video/io/VideoWriter.py
import os
from typing import List, Optional, Union
from moviepy.editor import VideoClip
from tqdm import tqdm
from mugen.utilities.logger import logger
from mugen.utilities.system import use_temporary_file_fallback

        video_clip

        output_path

        audio
            Audio for the video clip. Can be True to enable, False to disable, or an external audio file.

        verbose
            Whether output to stdout should include extra information during writing

        show_progress
            Whether to output progress information to stdout

        kwargs
            List of other keyword arguments to pass to moviepy's write_videofile
        """
        # Prepend crf to ffmpeg_params
        ffmpeg_params = ["-crf", str(self.crf)] + self.ffmpeg_params
        audio_bitrate = str(self.audio_bitrate) + "k"

        video_clip.write_videofile(
            output_path,
            audio=audio,
            preset=self.preset,
            codec=self.codec,
            audio_codec=self.audio_codec,
            audio_bitrate=audio_bitrate,
            ffmpeg_params=ffmpeg_params,
            **kwargs,
            verbose=verbose,

            logger=logger if show_progress else None