兼容安卓手机不能分享生成视频的问题

This commit is contained in:
YaoFANGUK
2024-01-04 14:33:33 +08:00
parent fda9024084
commit f9dd30fddf
4 changed files with 7 additions and 4 deletions

View File

@@ -64,6 +64,8 @@ class InpaintMode(Enum):
# ×××××××××××××××××××× [可以改] start ××××××××××××××××××××
# 是否使用h264编码如果需要安卓手机分享生成的视频请打开该选项
USE_H264 = True
# ×××××××××× 通用设置 start ××××××××××
# 【设置inpaint算法】
@@ -86,7 +88,8 @@ PIXEL_TOLERANCE_X = 20 # 允许检测框横向偏差的像素点数
# ×××××××××× InpaintMode.STTN算法设置 start ××××××××××
# 以下参数仅适用STTN算法时才生效
# 是否使用跳过检测,跳过字幕检测会省去很大时间,但是可能误伤无字幕的视频帧
STTN_SKIP_DETECTION = True
# 注意:将STTN_SKIP_DETECTION设置为True可能会导致去除的字幕漏了
STTN_SKIP_DETECTION = False
# 相邻帧数, 调大会增加显存占用,效果变好
STTN_NEIGHBOR_STRIDE = 10
# 参考帧长度, 调大会增加显存占用,效果变好

View File

@@ -845,7 +845,7 @@ class SubtitleRemover:
audio_merge_command = [config.FFMPEG_PATH,
"-y", "-i", self.video_temp_file.name,
"-i", temp.name,
"-vcodec", "copy",
"-vcodec", "libx264" if config.USE_H264 else "copy",
"-acodec", "copy",
"-loglevel", "error", self.video_out_name]
try:

View File

@@ -22,8 +22,8 @@ def merge_video(video_input_path0, video_input_path1, video_output_path):
if __name__ == '__main__':
v0_path = '../../test/test_2_low.mp4'
v1_path = '../../test/test_2_low_no_sub.mp4'
v0_path = '../../test/test4.mp4'
v1_path = '../../test/test4_no_sub.mp4'
video_out_path = '../../test/demo.mp4'
merge_video(v0_path, v1_path, video_out_path)
# ffmpeg 命令 mp4转gif