@lee-jisoo/n8n-nodes-mediafx 1.6.8 → 1.6.10
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.
|
@@ -97,20 +97,21 @@ function isASSFile(filePath) {
|
|
|
97
97
|
* Convert SRT content to ASS format with full styling support
|
|
98
98
|
*/
|
|
99
99
|
function convertSRTtoASS(srtContent, fontName, fontSize, primaryColor, outlineColor, outlineWidth, backColor, enableBackground, alignment, marginV, marginL, marginR, videoWidth, videoHeight) {
|
|
100
|
-
// BorderStyle=3
|
|
101
|
-
//
|
|
100
|
+
// BorderStyle=3 enables opaque box mode where BackColour determines the box color
|
|
101
|
+
// IMPORTANT: When BorderStyle=3, Outline MUST be 0, otherwise it overrides BackColour transparency
|
|
102
|
+
// Shadow must be 1 for the background box to display properly
|
|
102
103
|
let borderStyle;
|
|
103
104
|
let outline;
|
|
104
105
|
let shadow;
|
|
105
106
|
let effectiveOutlineColor;
|
|
106
107
|
if (enableBackground) {
|
|
107
|
-
borderStyle = 3;
|
|
108
|
-
outline =
|
|
109
|
-
shadow =
|
|
110
|
-
effectiveOutlineColor = backColor;
|
|
108
|
+
borderStyle = 3; // Opaque box mode - BackColour becomes the box background
|
|
109
|
+
outline = 0; // MUST be 0, non-zero overrides BackColour
|
|
110
|
+
shadow = 1; // MUST be 1 for box to display
|
|
111
|
+
effectiveOutlineColor = backColor;
|
|
111
112
|
}
|
|
112
113
|
else {
|
|
113
|
-
borderStyle = 1;
|
|
114
|
+
borderStyle = 1; // Normal outline mode
|
|
114
115
|
outline = outlineWidth;
|
|
115
116
|
shadow = 0;
|
|
116
117
|
effectiveOutlineColor = outlineColor;
|
|
@@ -227,10 +228,15 @@ async function executeAddSubtitle(video, subtitleFile, style, itemIndex) {
|
|
|
227
228
|
tempAssFile = path.join(os.tmpdir(), `mediafx_sub_${Date.now()}_${Math.random().toString(36).substring(7)}.ass`);
|
|
228
229
|
await fs.writeFile(tempAssFile, assContent, 'utf-8');
|
|
229
230
|
finalSubtitlePath = tempAssFile;
|
|
231
|
+
// Debug: log ASS content for troubleshooting
|
|
232
|
+
console.log('[MediaFX] Generated ASS file:', tempAssFile);
|
|
233
|
+
console.log('[MediaFX] ASS Style line:', assContent.split('\n').find(line => line.startsWith('Style:')));
|
|
230
234
|
}
|
|
231
|
-
// 5. Build FFmpeg command
|
|
235
|
+
// 5. Build FFmpeg command with fontsdir for custom fonts
|
|
232
236
|
const escapedPath = escapeSubtitlePath(finalSubtitlePath);
|
|
233
|
-
const
|
|
237
|
+
const fontPath = font.path;
|
|
238
|
+
const fontDir = escapeSubtitlePath(path.dirname(fontPath));
|
|
239
|
+
const subtitlesFilter = `ass='${escapedPath}':fontsdir='${fontDir}'`;
|
|
234
240
|
const command = ffmpeg(video)
|
|
235
241
|
.videoFilters([subtitlesFilter])
|
|
236
242
|
.audioCodec('copy')
|
package/package.json
CHANGED