add_text_overlay
Add customizable text overlays to video timelines in Adobe Premiere Pro. Specify content, position, duration, font, and color, ensuring precise placement and alignment.
Instructions
Adds a text layer (title) over the video timeline.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alignment | No | Text alignment | |
| color | No | The hex color code for the text, e.g., "#FFFFFF" | |
| duration | Yes | How long the text should remain on screen in seconds | |
| fontFamily | No | e.g., "Arial", "Times New Roman" | |
| fontSize | No | e.g., 48 | |
| position | No | Text position on screen | |
| sequenceId | Yes | The sequence to add the text to | |
| startTime | Yes | The time in seconds when the text should appear | |
| text | Yes | The text content to display | |
| trackIndex | Yes | The video track to place the text on |
Implementation Reference
- src/tools/index.ts:1513-1579 (handler)The main handler function for the 'add_text_overlay' tool. It generates an ExtendScript that creates a new title item in Premiere Pro using app.project.createNewTitle(), configures its text properties (font, size, color, position, alignment), and inserts it as a clip on the specified video track at the given start time with the specified duration.private async addTextOverlay(args: any): Promise<any> { const script = ` try { var sequence = app.project.getSequenceByID("${args.sequenceId}"); if (!sequence) { JSON.stringify({ success: false, error: "Sequence not found" }); return; } var track = sequence.videoTracks[${args.trackIndex}]; if (!track) { JSON.stringify({ success: false, error: "Video track not found" }); return; } // Create a text clip using the legacy title system var titleItem = app.project.createNewTitle("${args.text}"); if (!titleItem) { JSON.stringify({ success: false, error: "Failed to create title" }); return; } // Set text properties using the legacy title API var title = titleItem.getText(); if (title) { title.text = "${args.text}"; ${args.fontFamily ? `title.fontFamily = "${args.fontFamily}";` : ''} ${args.fontSize ? `title.fontSize = ${args.fontSize};` : ''} ${args.color ? `title.fillColor = "${args.color}";` : ''} ${args.position ? ` title.horizontalJustification = "${args.alignment || 'center'}"; title.verticalJustification = "center"; ` : ''} } // Insert the title into the timeline var titleClip = track.insertClip(titleItem, new Time("${args.startTime}s")); titleClip.end = new Time(titleClip.start.seconds + ${args.duration}); JSON.stringify({ success: true, message: "Text overlay added successfully", text: "${args.text}", clipId: titleClip.nodeId, startTime: ${args.startTime}, duration: ${args.duration}, trackIndex: ${args.trackIndex} }); } catch (e) { JSON.stringify({ success: false, error: e.toString() }); } `; return await this.bridge.executeScript(script); }
- src/tools/index.ts:261-278 (schema)The Zod input schema definition and tool metadata (name, description) for 'add_text_overlay', registered in the getAvailableTools() method.name: 'add_text_overlay', description: 'Adds a text layer (title) over the video timeline.', inputSchema: z.object({ text: z.string().describe('The text content to display'), sequenceId: z.string().describe('The sequence to add the text to'), trackIndex: z.number().describe('The video track to place the text on'), startTime: z.number().describe('The time in seconds when the text should appear'), duration: z.number().describe('How long the text should remain on screen in seconds'), fontFamily: z.string().optional().describe('e.g., "Arial", "Times New Roman"'), fontSize: z.number().optional().describe('e.g., 48'), color: z.string().optional().describe('The hex color code for the text, e.g., "#FFFFFF"'), position: z.object({ x: z.number().optional().describe('Horizontal position (0-100)'), y: z.number().optional().describe('Vertical position (0-100)') }).optional().describe('Text position on screen'), alignment: z.enum(['left', 'center', 'right']).optional().describe('Text alignment') }) },
- src/tools/index.ts:492-494 (registration)The switch case in executeTool() that registers and dispatches calls to the addTextOverlay handler.case 'add_text_overlay': return await this.addTextOverlay(args); case 'add_shape':
- dist/tools/index.d.ts:46-46 (registration)TypeScript declaration of the addTextOverlay method in the built tools index.private addTextOverlay;