@lee-jisoo/n8n-nodes-mediafx 1.6.6 → 1.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -96,22 +96,36 @@ function isASSFile(filePath) {
96
96
  /**
97
97
  * Convert SRT content to ASS format with full styling support
98
98
  */
99
- function convertSRTtoASS(srtContent, fontName, fontSize, primaryColor, outlineColor, outlineWidth, backColor, enableBackground, alignment, marginV, marginL, marginR) {
100
- // BorderStyle: 1=outline+shadow, 3=opaque box
101
- const borderStyle = enableBackground ? 3 : 1;
102
- const outline = enableBackground ? 0 : outlineWidth;
103
- const shadow = enableBackground ? 2 : 0;
99
+ function convertSRTtoASS(srtContent, fontName, fontSize, primaryColor, outlineColor, outlineWidth, backColor, enableBackground, alignment, marginV, marginL, marginR, videoWidth, videoHeight) {
100
+ // BorderStyle=3 with large Outline creates a background box effect
101
+ // OutlineColour is used as the box color when BorderStyle=3
102
+ let borderStyle;
103
+ let outline;
104
+ let shadow;
105
+ let effectiveOutlineColor;
106
+ if (enableBackground) {
107
+ borderStyle = 3;
108
+ outline = 15; // Large outline creates box effect
109
+ shadow = 0;
110
+ effectiveOutlineColor = backColor; // Use background color as outline
111
+ }
112
+ else {
113
+ borderStyle = 1;
114
+ outline = outlineWidth;
115
+ shadow = 0;
116
+ effectiveOutlineColor = outlineColor;
117
+ }
104
118
  const header = `[Script Info]
105
119
  Title: Generated by MediaFX
106
120
  ScriptType: v4.00+
107
121
  WrapStyle: 0
108
122
  ScaledBorderAndShadow: yes
109
- PlayResX: 1920
110
- PlayResY: 1080
123
+ PlayResX: ${videoWidth}
124
+ PlayResY: ${videoHeight}
111
125
 
112
126
  [V4+ Styles]
113
127
  Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
114
- Style: Default,${fontName},${fontSize},${primaryColor},${primaryColor},${outlineColor},${backColor},0,0,0,0,100,100,0,0,${borderStyle},${outline},${shadow},${alignment},${marginL},${marginR},${marginV},1
128
+ Style: Default,${fontName},${fontSize},${primaryColor},${primaryColor},${effectiveOutlineColor},${backColor},0,0,0,0,100,100,0,0,${borderStyle},${outline},${shadow},${alignment},${marginL},${marginR},${marginV},1
115
129
 
116
130
  [Events]
117
131
  Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
@@ -185,7 +199,20 @@ async function executeAddSubtitle(video, subtitleFile, style, itemIndex) {
185
199
  const primaryColorASS = colorToASS(fontColor, 1);
186
200
  const outlineColorASS = colorToASS(outlineColor, 1);
187
201
  const backColorASS = colorToASS(backgroundColor, backgroundOpacity);
188
- // 4. Prepare subtitle file
202
+ // 4. Get video dimensions
203
+ let videoWidth = 1080;
204
+ let videoHeight = 1920;
205
+ try {
206
+ const videoInfo = await (0, utils_1.getVideoStreamInfo)(video);
207
+ if (videoInfo && videoInfo.width && videoInfo.height) {
208
+ videoWidth = videoInfo.width;
209
+ videoHeight = videoInfo.height;
210
+ }
211
+ }
212
+ catch (e) {
213
+ // Use default if ffprobe fails
214
+ }
215
+ // 5. Prepare subtitle file
189
216
  let finalSubtitlePath = subtitleFile;
190
217
  let tempAssFile = null;
191
218
  if (isASSFile(subtitleFile)) {
@@ -195,7 +222,7 @@ async function executeAddSubtitle(video, subtitleFile, style, itemIndex) {
195
222
  else {
196
223
  // SRT file: convert to ASS for full styling support
197
224
  const srtContent = await fs.readFile(subtitleFile, 'utf-8');
198
- const assContent = convertSRTtoASS(srtContent, fontName, fontSize, primaryColorASS, outlineColorASS, outlineWidth, backColorASS, enableBackground, alignment, paddingY, paddingX, paddingX);
225
+ const assContent = convertSRTtoASS(srtContent, fontName, fontSize, primaryColorASS, outlineColorASS, outlineWidth, backColorASS, enableBackground, alignment, paddingY, paddingX, paddingX, videoWidth, videoHeight);
199
226
  // Create temp ASS file with unique name
200
227
  tempAssFile = path.join(os.tmpdir(), `mediafx_sub_${Date.now()}_${Math.random().toString(36).substring(7)}.ass`);
201
228
  await fs.writeFile(tempAssFile, assContent, 'utf-8');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lee-jisoo/n8n-nodes-mediafx",
3
- "version": "1.6.6",
3
+ "version": "1.6.8",
4
4
  "description": "N8N custom nodes for video editing and media processing (Enhanced fork with Speed control and Subtitle fixes)",
5
5
  "license": "MIT",
6
6
  "author": {