# pylint: disable=import-outside-toplevel

import logging
import os

logger = logging.getLogger(__name__)


def video_to_audio(video_path: str, output_audio_path: str) -> None:
    """
    Convert a video to audio and save it to the output path.

    Parameters:
    video_path (str): The path to the video file.
    output_audio_path (str): The path to save the audio to.

    """
    os.environ["IMAGEIO_FFMPEG_EXE"] = os.environ.get("IMAGEIO_FFMPEG_EXE", "ffmpeg")
    import warnings

    with warnings.catch_warnings():
        warnings.filterwarnings("ignore")
        from moviepy import VideoFileClip

    clip = VideoFileClip(video_path)
    audio = clip.audio
    audio.write_audiofile(output_audio_path, bitrate="32k", logger=None)
