@lee-jisoo/n8n-nodes-mediafx 1.6.6 → 1.6.7
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,7 +96,7 @@ 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) {
|
|
99
|
+
function convertSRTtoASS(srtContent, fontName, fontSize, primaryColor, outlineColor, outlineWidth, backColor, enableBackground, alignment, marginV, marginL, marginR, videoWidth, videoHeight) {
|
|
100
100
|
// BorderStyle: 1=outline+shadow, 3=opaque box
|
|
101
101
|
const borderStyle = enableBackground ? 3 : 1;
|
|
102
102
|
const outline = enableBackground ? 0 : outlineWidth;
|
|
@@ -106,8 +106,8 @@ Title: Generated by MediaFX
|
|
|
106
106
|
ScriptType: v4.00+
|
|
107
107
|
WrapStyle: 0
|
|
108
108
|
ScaledBorderAndShadow: yes
|
|
109
|
-
PlayResX:
|
|
110
|
-
PlayResY:
|
|
109
|
+
PlayResX: ${videoWidth}
|
|
110
|
+
PlayResY: ${videoHeight}
|
|
111
111
|
|
|
112
112
|
[V4+ Styles]
|
|
113
113
|
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
|
|
@@ -185,7 +185,20 @@ async function executeAddSubtitle(video, subtitleFile, style, itemIndex) {
|
|
|
185
185
|
const primaryColorASS = colorToASS(fontColor, 1);
|
|
186
186
|
const outlineColorASS = colorToASS(outlineColor, 1);
|
|
187
187
|
const backColorASS = colorToASS(backgroundColor, backgroundOpacity);
|
|
188
|
-
// 4.
|
|
188
|
+
// 4. Get video dimensions
|
|
189
|
+
let videoWidth = 1080;
|
|
190
|
+
let videoHeight = 1920;
|
|
191
|
+
try {
|
|
192
|
+
const videoInfo = await (0, utils_1.getVideoStreamInfo)(video);
|
|
193
|
+
if (videoInfo && videoInfo.width && videoInfo.height) {
|
|
194
|
+
videoWidth = videoInfo.width;
|
|
195
|
+
videoHeight = videoInfo.height;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
catch (e) {
|
|
199
|
+
// Use default if ffprobe fails
|
|
200
|
+
}
|
|
201
|
+
// 5. Prepare subtitle file
|
|
189
202
|
let finalSubtitlePath = subtitleFile;
|
|
190
203
|
let tempAssFile = null;
|
|
191
204
|
if (isASSFile(subtitleFile)) {
|
|
@@ -195,7 +208,7 @@ async function executeAddSubtitle(video, subtitleFile, style, itemIndex) {
|
|
|
195
208
|
else {
|
|
196
209
|
// SRT file: convert to ASS for full styling support
|
|
197
210
|
const srtContent = await fs.readFile(subtitleFile, 'utf-8');
|
|
198
|
-
const assContent = convertSRTtoASS(srtContent, fontName, fontSize, primaryColorASS, outlineColorASS, outlineWidth, backColorASS, enableBackground, alignment, paddingY, paddingX, paddingX);
|
|
211
|
+
const assContent = convertSRTtoASS(srtContent, fontName, fontSize, primaryColorASS, outlineColorASS, outlineWidth, backColorASS, enableBackground, alignment, paddingY, paddingX, paddingX, videoWidth, videoHeight);
|
|
199
212
|
// Create temp ASS file with unique name
|
|
200
213
|
tempAssFile = path.join(os.tmpdir(), `mediafx_sub_${Date.now()}_${Math.random().toString(36).substring(7)}.ass`);
|
|
201
214
|
await fs.writeFile(tempAssFile, assContent, 'utf-8');
|
package/package.json
CHANGED