jebin2 commited on
Commit
08e2af2
Β·
1 Parent(s): 7f02294

caption issue fix

Browse files
Files changed (1) hide show
  1. src/video_renderer.py +3 -4
src/video_renderer.py CHANGED
@@ -41,6 +41,7 @@ class VideoRenderer:
41
  def __init__(self, config: Dict, data_holder: DataHolder = None):
42
  self.config = config
43
  self.data_holder = data_holder
 
44
  self.temp_dir = Path(tempfile.mkdtemp())
45
  if os.getenv("TEST_AUTOMATION", "").lower() == "true":
46
  self.temp_dir = Path(f'{os.getenv("TEST_DATA_DIRECTORY")}/output')
@@ -630,7 +631,6 @@ class VideoRenderer:
630
  else:
631
  fontsize = 95 # Reduced from 105
632
 
633
- cap_method, _ = self._get_caption_style()
634
  text_clip = create_text_clip(
635
  text,
636
  duration,
@@ -639,7 +639,7 @@ class VideoRenderer:
639
  start_time,
640
  fontsize,
641
  word_timings,
642
- **cap_method()
643
  )
644
  return text_clip
645
  # IMPROVED: Increased font weight with thicker stroke
@@ -719,8 +719,7 @@ class VideoRenderer:
719
  logger.info(f"πŸ“ Using fallback subtitles: {len(words)} words")
720
 
721
  # phrases = self._group_words_into_phrases(words, max_words=3)
722
- _, max_words_per_group = self._get_caption_style()
723
- phrases = group_words_by_time_and_width(script, target_width, target_height, max_words_per_group=max_words_per_group)
724
  logger.info(f"πŸ“ Grouped into {len(phrases)} phrases")
725
 
726
  duration_per_phrase = total_duration / len(phrases)
 
41
  def __init__(self, config: Dict, data_holder: DataHolder = None):
42
  self.config = config
43
  self.data_holder = data_holder
44
+ self.cap_method, self.max_words_per_group = self._get_caption_style()
45
  self.temp_dir = Path(tempfile.mkdtemp())
46
  if os.getenv("TEST_AUTOMATION", "").lower() == "true":
47
  self.temp_dir = Path(f'{os.getenv("TEST_DATA_DIRECTORY")}/output')
 
631
  else:
632
  fontsize = 95 # Reduced from 105
633
 
 
634
  text_clip = create_text_clip(
635
  text,
636
  duration,
 
639
  start_time,
640
  fontsize,
641
  word_timings,
642
+ **self.cap_method()
643
  )
644
  return text_clip
645
  # IMPROVED: Increased font weight with thicker stroke
 
719
  logger.info(f"πŸ“ Using fallback subtitles: {len(words)} words")
720
 
721
  # phrases = self._group_words_into_phrases(words, max_words=3)
722
+ phrases = group_words_by_time_and_width(script, target_width, target_height, max_words_per_group=self.max_words_per_group)
 
723
  logger.info(f"πŸ“ Grouped into {len(phrases)} phrases")
724
 
725
  duration_per_phrase = total_duration / len(phrases)