Skip to content

Commit

Permalink
兼容安卓手机不能分享生成视频的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
YaoFANGUK committed Jan 4, 2024
1 parent fda9024 commit f9dd30f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class InpaintMode(Enum):


# ×××××××××××××××××××× [可以改] start ××××××××××××××××××××
# 是否使用h264编码,如果需要安卓手机分享生成的视频,请打开该选项
USE_H264 = True

# ×××××××××× 通用设置 start ××××××××××
# 【设置inpaint算法】
Expand All @@ -86,7 +88,8 @@ class InpaintMode(Enum):
# ×××××××××× InpaintMode.STTN算法设置 start ××××××××××
# 以下参数仅适用STTN算法时,才生效
# 是否使用跳过检测,跳过字幕检测会省去很大时间,但是可能误伤无字幕的视频帧
STTN_SKIP_DETECTION = True
# 注意:将STTN_SKIP_DETECTION设置为True可能会导致去除的字幕漏了
STTN_SKIP_DETECTION = False
# 相邻帧数, 调大会增加显存占用,效果变好
STTN_NEIGHBOR_STRIDE = 10
# 参考帧长度, 调大会增加显存占用,效果变好
Expand Down
2 changes: 1 addition & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ def merge_audio_to_video(self):
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:
Expand Down
4 changes: 2 additions & 2 deletions backend/tools/merge_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file added test/test4.mp4
Binary file not shown.

0 comments on commit f9dd30f

Please sign in to comment.