multilang-asr-captioner / utils /process_video.py
marquesafonso's picture
add validation for other video formats; double cache size; adapt to device_type change in transcriber
fc6dd1b
raw
history blame contribute delete
885 Bytes
import logging, os
from utils.subtitler import subtitler
def process_video(invideo_file: str,
srt_string:str,
srt_json: str,
fontsize:str,
font:str,
bg_color:str,
text_color:str,
highlight_mode: bool,
highlight_color: str,
device_type:str,
temp_dir: str
):
invideo_path_parts = os.path.normpath(invideo_file).split(os.path.sep)
VIDEO_NAME = os.path.basename(invideo_file)
OUTVIDEO_PATH = os.path.join(os.path.normpath('/'.join(invideo_path_parts[:-1])), f"result_{VIDEO_NAME}")
logging.info("Subtitling...")
subtitler(invideo_file, srt_string, srt_json, OUTVIDEO_PATH, fontsize, font, bg_color, text_color, highlight_mode, highlight_color, device_type, temp_dir)
return OUTVIDEO_PATH