marquesafonso commited on
Commit
284187c
·
1 Parent(s): 080d626

fix sound issues (2)

Browse files
Files changed (1) hide show
  1. utils/subtitler.py +2 -2
utils/subtitler.py CHANGED
@@ -43,7 +43,7 @@ def subtitler(video_file:str,
43
  output_file = os.path.abspath(output_file)
44
  temp_dir = os.path.abspath(f"{'/'.join(os.path.normpath(video_file).split(os.path.sep)[:-1])}/")
45
  temp_audiofile = os.path.join(temp_dir, "temp_audio_file.mp4")
46
- clip = VideoFileClip(filename=video_file, target_resolution=None)
47
  subtitles = parse_srt(srt_path)
48
  subtitle_clips = []
49
  caption_width_ratio, caption_height_ratio = filter_caption_width(caption_mode)
@@ -59,4 +59,4 @@ def subtitler(video_file:str,
59
  subtitle_clips.append(txt_clip.set_position(text_position))
60
  video = CompositeVideoClip(size=None, clips=[clip] + subtitle_clips)
61
  video.set_audio(temp_audiofile)
62
- video.write_videofile(output_file, codec='libx264', audio_codec='aac')
 
43
  output_file = os.path.abspath(output_file)
44
  temp_dir = os.path.abspath(f"{'/'.join(os.path.normpath(video_file).split(os.path.sep)[:-1])}/")
45
  temp_audiofile = os.path.join(temp_dir, "temp_audio_file.mp4")
46
+ clip = VideoFileClip(filename=video_file, target_resolution=None, resize_algorithm='bitexact')
47
  subtitles = parse_srt(srt_path)
48
  subtitle_clips = []
49
  caption_width_ratio, caption_height_ratio = filter_caption_width(caption_mode)
 
59
  subtitle_clips.append(txt_clip.set_position(text_position))
60
  video = CompositeVideoClip(size=None, clips=[clip] + subtitle_clips)
61
  video.set_audio(temp_audiofile)
62
+ video.write_videofile(output_file, codec='libx264', audio_codec='aac', temp_audiofile = temp_audiofile)