~~~

x, y, w, h = watermark.split(",")

# https://www.jianshu.com/p/dfcfd4432367

# x,y的起始值是从1开始,从0开始会报错

if int(x) == 0:

x = 1

if int(y) == 0:

y = 1

w, h = int(w) - 1, int(h) - 1

# if file_suffix in SUFFIX_VIDEO:

remove_video_path = os.path.join(temp_dir, f"temp_{generate_hash()}.{file_suffix}")

# 可能有多个水印,覆盖上传的视频文件

cmd_water = f"{FFMPEG_PATH} -i {save_file_path} -filter_complex delogo=x={x}:y={y}:w={w}:h={h}:show=0 " \

f"-y {remove_video_path} -loglevel quiet"

my_print(f"去除水印命令:{cmd_water}")

ffmpeg_code = subprocess.call(cmd_water, shell=True)

my_print(f"去除水印执行结果:{ffmpeg_code}")

~~~