@lee-jisoo/n8n-nodes-mediafx 1.6.3 → 1.6.4

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.
@@ -132,13 +132,42 @@ async function executeAddSubtitle(video, subtitleFile, style, itemIndex) {
132
132
  const positionType = style.positionType || 'alignment';
133
133
  let horizontalAlign = 'center';
134
134
  let verticalAlign = 'bottom';
135
- let marginV = 20;
135
+ let paddingY = 20;
136
136
  if (positionType === 'alignment') {
137
137
  horizontalAlign = style.horizontalAlign || 'center';
138
138
  verticalAlign = style.verticalAlign || 'bottom';
139
- marginV = (_d = style.paddingY) !== null && _d !== void 0 ? _d : 20;
139
+ paddingY = (_d = style.paddingY) !== null && _d !== void 0 ? _d : 20;
140
140
  }
141
141
  const alignment = getASSAlignment(horizontalAlign, verticalAlign);
142
+ // Get video height for accurate MarginV calculation
143
+ let videoHeight = 1080; // default fallback
144
+ try {
145
+ const videoInfo = await (0, utils_1.getVideoStreamInfo)(video);
146
+ if (videoInfo && videoInfo.height) {
147
+ videoHeight = videoInfo.height;
148
+ }
149
+ }
150
+ catch (e) {
151
+ // Use default if ffprobe fails
152
+ console.warn('Could not get video height, using default 1080');
153
+ }
154
+ // Calculate MarginV based on vertical alignment and video height
155
+ // ASS MarginV is the distance from the alignment edge
156
+ // For middle alignment, we calculate the margin to center the subtitle
157
+ let marginV = paddingY;
158
+ if (verticalAlign === 'middle') {
159
+ // For middle alignment (4,5,6), MarginV pushes from bottom
160
+ // To center: marginV = (videoHeight / 2) - fontSize - some_offset
161
+ // Simplified: use ~37% of video height as margin from bottom
162
+ marginV = Math.round(videoHeight * 0.37);
163
+ }
164
+ else if (verticalAlign === 'top') {
165
+ marginV = paddingY;
166
+ }
167
+ else {
168
+ // bottom
169
+ marginV = paddingY;
170
+ }
142
171
  // 3. Convert colors to ASS format
143
172
  const primaryColorASS = colorToASS(fontColor, 1);
144
173
  const outlineColorASS = colorToASS(outlineColor, 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lee-jisoo/n8n-nodes-mediafx",
3
- "version": "1.6.3",
3
+ "version": "1.6.4",
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": {