ffmpeg视频合并

``` def step_7_mp4_to_ts(merge_video_list): """ 将处理好的视频合并在一起 :param merge_video_list: 视频列表 :return: """ video_ts_list = [] # 视频合并前,将mp4转为ts for mp4_pa...

视频音频字幕文件的合并,ffmpeg

``` def step_4_generate_srt_by_char_calculation(wav_dict_path): result_srt_list = [] for index, item in enumerate(wav_dict_path): path = item.get("pat...

通过音频文件生成字幕文件

``` def step_4_generate_srt_by_whisper(wav_dict_path): """ 使用openai的whisper,从音频文件中提取文本,生成字幕文件 容易出现错别字 :param wav_dict_path: :return: """ model = whisp...

langchain加本地知识库,输出内容

``` import json import os from typing import List, Optional from langchain import LLMChain, PromptTemplate from langchain.chat_models import ChatOpenA...

替换PPT里的文本内容

``` def replace_text(replacements, shapes): """ 替换PPT里的文本内容 """ for shape in shapes: for match, replacement in replacements.items(): match = str(match...

图片背景透明

``` def pic_bg_alpha(img_path): """ 图片背景透明 :param img_path: 图片地址 :return: """ from PIL import Image img = Image.open(img_path) rgba_img = img.convert(...

milvus单机版安装docker compose

``` version: '3.5' services: etcd: container_name: milvus-etcd image: quay.io/coreos/etcd:v3.5.5 environment: - ETCD_AUTO_COMPACTION_MODE=revision - E...

获取当前年月日时分秒

``` def get_now_time(): """ 获取当前年月日时分秒 :return: """ now_str = time.strftime('%Y%m%d%H%M%S', time.localtime(time.time())) return now_str ```...

传入秒数,生成字幕时间

``` def second_to_time(second=0): """ 传入秒数,生成字幕时间 :param second: 13 :return: 00:00:13 """ # b = 61 # 10秒,如果是小数,只舍不入 hour_min_second = time.strftime('%...

是否是中文字符

``` def is_chinese(char): if '\u4e00' <= char <= '\u9fff': return True else: return False ```...