submaster/whisper_project/infra/process_video.py

41 lines
1.1 KiB
Python

"""Infra wrapper exposing ffmpeg and transcription helpers via adapters.
This module provides backward-compatible functions but delegates to the
adapter implementations in `ffmpeg_adapter` and `transcribe`.
"""
from .ffmpeg_adapter import FFmpegAudioProcessor
from . import transcribe as _trans
_FF = FFmpegAudioProcessor()
def extract_audio(video_path: str, out_wav: str, sr: int = 16000):
return _FF.extract_audio(video_path, out_wav)
def burn_subtitles(video_path: str, srt_path: str, out_video: str, font: str = "Arial", size: int = 24):
return _FF.burn_subtitles(video_path, srt_path, out_video, font=font, size=size)
def replace_audio_in_video(video_path: str, audio_path: str, out_video: str):
return _FF.replace_audio_in_video(video_path, audio_path, out_video)
def get_audio_duration(file_path: str):
return _trans.get_audio_duration(file_path)
def transcribe_segmented_with_tempfiles(*args, **kwargs):
return _trans.transcribe_segmented_with_tempfiles(*args, **kwargs)
__all__ = [
"extract_audio",
"burn_subtitles",
"replace_audio_in_video",
"get_audio_duration",
"transcribe_segmented_with_tempfiles",
]