Spaces:
Sleeping
Sleeping
aladhefafalquran Claude Sonnet 4.5 commited on
Commit ·
2d54a92
1
Parent(s): 2a1d387
Make subtitles larger and center them in middle of screen
Browse files- Increase font size from 32 to 56 for better visibility
- Change alignment from 2 (bottom center) to 5 (center middle)
- Reduce margins to 50 for true center positioning
- Increase outline to 3 and shadow to 2 for better contrast
- Perfect for video editing workflows (chroma key, etc.)
User will composite in editing app, so centered positioning is ideal.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- src/subtitle_generator.py +5 -2
- src/video_generator.py +1 -1
src/subtitle_generator.py
CHANGED
|
@@ -116,12 +116,15 @@ class SubtitleGenerator:
|
|
| 116 |
self,
|
| 117 |
verses: List[MatchedVerse],
|
| 118 |
filename: str = "quran_subtitles.ass",
|
| 119 |
-
font_size: int =
|
| 120 |
) -> str:
|
| 121 |
"""Generate ASS subtitle file with proper styling for Arabic"""
|
| 122 |
output_path = self.output_dir / filename
|
| 123 |
|
| 124 |
# ASS header with proper styling
|
|
|
|
|
|
|
|
|
|
| 125 |
ass_content = [
|
| 126 |
"[Script Info]",
|
| 127 |
"ScriptType: v4.00+",
|
|
@@ -131,7 +134,7 @@ class SubtitleGenerator:
|
|
| 131 |
"",
|
| 132 |
"[V4+ Styles]",
|
| 133 |
"Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding",
|
| 134 |
-
f"Style: Default,Arial,{font_size},&H00FFFFFF,&H000000FF,&H00000000,&H80000000,0,0,0,0,100,100,0,0,1,
|
| 135 |
"",
|
| 136 |
"[Events]",
|
| 137 |
"Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"
|
|
|
|
| 116 |
self,
|
| 117 |
verses: List[MatchedVerse],
|
| 118 |
filename: str = "quran_subtitles.ass",
|
| 119 |
+
font_size: int = 56
|
| 120 |
) -> str:
|
| 121 |
"""Generate ASS subtitle file with proper styling for Arabic"""
|
| 122 |
output_path = self.output_dir / filename
|
| 123 |
|
| 124 |
# ASS header with proper styling
|
| 125 |
+
# Alignment: 5 = center middle (perfect for video editing)
|
| 126 |
+
# Larger font size (56) for better visibility
|
| 127 |
+
# Minimal margins for true center positioning
|
| 128 |
ass_content = [
|
| 129 |
"[Script Info]",
|
| 130 |
"ScriptType: v4.00+",
|
|
|
|
| 134 |
"",
|
| 135 |
"[V4+ Styles]",
|
| 136 |
"Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding",
|
| 137 |
+
f"Style: Default,Arial,{font_size},&H00FFFFFF,&H000000FF,&H00000000,&H80000000,0,0,0,0,100,100,0,0,1,3,2,5,50,50,50,1",
|
| 138 |
"",
|
| 139 |
"[Events]",
|
| 140 |
"Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"
|
src/video_generator.py
CHANGED
|
@@ -130,7 +130,7 @@ class VideoGenerator:
|
|
| 130 |
output_path: str,
|
| 131 |
background_image: Optional[str] = None,
|
| 132 |
resolution: str = "1920x1080",
|
| 133 |
-
font_size: int =
|
| 134 |
font_color: str = "white",
|
| 135 |
bg_color: str = "black",
|
| 136 |
ass_path: Optional[str] = None
|
|
|
|
| 130 |
output_path: str,
|
| 131 |
background_image: Optional[str] = None,
|
| 132 |
resolution: str = "1920x1080",
|
| 133 |
+
font_size: int = 56,
|
| 134 |
font_color: str = "white",
|
| 135 |
bg_color: str = "black",
|
| 136 |
ass_path: Optional[str] = None
|