Skip to main content
This guide shows you how to automatically highlight important words in your video subtitles using AI-powered keyword detection. Perfect for emphasizing key points, product names, or calls-to-action in your videos.

What You’ll Learn

Keyword Highlighting

Automatically emphasize important words

AI Detection

AI identifies key terms automatically

Scene Control

Show or hide subtitles per scene

Style Integration

Works with any subtitle style

Before You Begin

Make sure you have:
  • A Pictory API key (get one here)
  • Node.js or Python installed on your machine
  • Basic understanding of subtitle styling
  • Content with keywords worth highlighting
npm install axios

How Keyword Highlighting Works

When you enable keyword highlighting:
  1. AI Analysis - The AI analyzes text content in each scene
  2. Keyword Detection - Important words are identified (nouns, key verbs, concepts)
  3. Color Application - Keywords display in the specified keywordColor
  4. Regular Text - Other words appear in standard subtitle color
  5. Video Rendering - Subtitles render with highlighted keywords
Keyword highlighting uses AI to automatically identify important words. You don’t need to manually specify which words to highlight - the AI determines this based on content analysis.

Complete Example

import axios from "axios";

const API_BASE_URL = "https://api.pictory.ai/pictoryapis";
const API_KEY = "YOUR_API_KEY";

const STORY_TEXT_1 = "AI is poised to significantly impact educators and course creators on social media.";
const STORY_TEXT_2 = "By automating tasks like content generation, visual design, and video editing, AI will save time and enhance consistency.";

async function createVideoWithKeywordHighlighting() {
  try {
    console.log("Creating video with keyword highlighting...");

    const response = await axios.post(
      `${API_BASE_URL}/v2/video/storyboard/render`,
      {
        videoName: "text_to_video_highlight_keywords",

        // Subtitle style with keyword color
        subtitleStyle: {
          fontFamily: "Poppins",
          fontSize: 48,
          color: "rgba(255, 255, 255, 1)",          // White for regular text
          backgroundColor: "rgba(0, 0, 0, 0.7)",    // Black background
          keywordColor: "rgba(255, 215, 0, 1)",     // Gold for highlighted keywords
          position: "bottom-center",
        },

        scenes: [
          {
            story: STORY_TEXT_1,
            createSceneOnNewLine: false,
            createSceneOnEndOfSentence: false,
            highlightKeywords: true,      // Enable keyword highlighting
            hideSubtitles: false,         // Show subtitles
          },
          {
            story: STORY_TEXT_2,
            createSceneOnNewLine: false,
            createSceneOnEndOfSentence: false,
            highlightKeywords: false,     // No highlighting for this scene
            hideSubtitles: true,          // Hide subtitles for this scene
          },
        ],
      },
      {
        headers: {
          "Content-Type": "application/json",
          Authorization: API_KEY,
        },
      }
    );

    const jobId = response.data.data.jobId;
    console.log("✓ Video creation started!");
    console.log("Job ID:", jobId);

    // Monitor progress
    console.log("\nMonitoring video creation...");
    let jobCompleted = false;
    let jobResult = null;

    while (!jobCompleted) {
      const statusResponse = await axios.get(
        `${API_BASE_URL}/v1/jobs/${jobId}`,
        {
          headers: { Authorization: API_KEY },
        }
      );

      const status = statusResponse.data.data.status;
      console.log("Status:", status);

      if (status === "completed") {
        jobCompleted = true;
        jobResult = statusResponse.data;
        console.log("\n✓ Video with keyword highlighting is ready!");
        console.log("Video URL:", jobResult.data.videoURL);
      } else if (status === "failed") {
        throw new Error("Video creation failed: " + JSON.stringify(statusResponse.data));
      }

      await new Promise(resolve => setTimeout(resolve, 5000));
    }

    return jobResult;
  } catch (error) {
    console.error("Error:", error.response?.data || error.message);
    throw error;
  }
}

createVideoWithKeywordHighlighting();

Understanding the Parameters

Scene-Level Parameters

ParameterTypeDefaultDescription
highlightKeywordsbooleanfalseEnable/disable AI keyword highlighting for this scene
hideSubtitlesbooleanfalseShow/hide all subtitles for this scene

Required Style Property

ParameterTypeDescription
subtitleStyle.keywordColorstringRGBA color for highlighted keywords (e.g., rgba(255, 215, 0, 1))
Keyword Color Required: You must define keywordColor in your subtitleStyle for highlighting to be visible. Without this color specification, keywords won’t appear different from regular text.

What Gets Highlighted

The AI automatically identifies and highlights:
Word TypeExamplesTypical Highlighting
Key NounsAI, educators, social media, contentImportant subjects and objects
Action Verbsimpact, automate, enhance, createSignificant actions
Important Conceptsgeneration, consistency, efficiencyCore ideas
Product NamesBrand names, specific productsProper nouns
NumbersStatistics, percentages, quantitiesNumerical data
Call-to-Actionsubscribe, buy, learn, joinAction words
The AI is trained to identify contextually important words. The same word might be highlighted in one context but not another, depending on its importance to the message.

Common Use Cases

Educational Content with Key Terms

{
  subtitleStyle: {
    color: "rgba(255, 255, 255, 1)",
    keywordColor: "rgba(100, 200, 255, 1)",  // Light blue for terms
    backgroundColor: "rgba(0, 0, 0, 0.7)"
  },
  scenes: [{
    story: "Machine learning algorithms analyze data patterns.",
    highlightKeywords: true
  }]
}
Result: “Machine learning”, “algorithms”, “data patterns” highlighted in blue.

Marketing with Product Names

{
  subtitleStyle: {
    color: "rgba(255, 255, 255, 1)",
    keywordColor: "rgba(255, 100, 100, 1)",  // Red for emphasis
    backgroundColor: "rgba(0, 0, 0, 0.8)"
  },
  scenes: [{
    story: "Try our Premium Plan for unlimited videos.",
    highlightKeywords: true
  }]
}
Result: “Premium Plan”, “unlimited videos” highlighted in red.

Social Media Call-to-Action

{
  subtitleStyle: {
    color: "rgba(255, 255, 255, 1)",
    keywordColor: "rgba(255, 215, 0, 1)",    // Gold for action
    backgroundColor: "rgba(0, 0, 0, 0.7)"
  },
  scenes: [{
    story: "Subscribe now and get exclusive access!",
    highlightKeywords: true
  }]
}
Result: “Subscribe”, “exclusive access” highlighted in gold.

Mixed Highlighting Across Scenes

{
  scenes: [
    {
      story: "Introduction to our platform",
      highlightKeywords: false    // No highlighting for intro
    },
    {
      story: "Key features include automation and analytics",
      highlightKeywords: true     // Highlight key features
    },
    {
      story: "Closing thoughts and summary",
      hideSubtitles: true         // No subtitles for outro
    }
  ]
}
Result: Strategic highlighting only where it adds value.

Best Practices

Select keyword colors that stand out:
  • High Contrast: Ensure keyword color contrasts with both regular text and background
  • Brand Colors: Use brand colors for consistency
  • Readability: Test that highlighted text is still easy to read
  • Common Choices: Gold, light blue, bright red, or neon green
  • Avoid Similar: Don’t use colors too similar to regular text color
Apply keyword highlighting where it adds value:
  • Educational Videos: Highlight technical terms and concepts
  • Marketing: Emphasize product names and benefits
  • Social Media: Draw attention to calls-to-action
  • Tutorials: Highlight steps and important instructions
  • Avoid Overuse: Not every scene needs highlighting
Structure your text to work well with keyword detection:
  • Use Strong Nouns: Include specific, meaningful nouns
  • Clear Concepts: State ideas explicitly rather than implying
  • Product Names: Capitalize proper nouns consistently
  • Action Words: Use clear verbs for calls-to-action
  • Natural Language: Write conversationally but with key terms
Preview to ensure highlighting works as intended:
  • Create Test Videos: Try short samples first
  • Check Keywords: Verify important words are highlighted
  • Color Visibility: Ensure keyword color is visible
  • Over-Highlighting: Check if too many words are highlighted
  • Adjust Content: Rewrite if highlighting isn’t effective
Enhance keyword highlighting with complementary features:
  • Custom Styles: Use bold or larger font for keyword emphasis
  • Animations: Add subtle entry animations to draw attention
  • Voice Emphasis: Pair with voice-over for audio+visual emphasis
  • Scene Timing: Give highlighted scenes slightly longer duration
  • Background Music: Lower music volume during key highlighted sections

Troubleshooting

Problem: Text appears but no words are highlighted in different color.Solution:
  • Ensure highlightKeywords: true is set in scene configuration
  • Verify keywordColor is defined in subtitleStyle
  • Check keyword color is different from regular text color
  • Confirm RGBA format is correct for keywordColor
  • Test with content that has clear important nouns/verbs
  • Try more explicit, keyword-rich text
Problem: AI highlights unexpected or less important words.Solution:
  • Rewrite content to emphasize desired keywords
  • Use more specific, concrete nouns instead of generic words
  • Place important concepts at start or end of sentences
  • Capitalize proper nouns (product names, brands)
  • Remove filler words and keep text concise
  • Test with different phrasings to see what works best
Problem: Highlighted keywords blend in or are hard to see.Solution:
  • Increase contrast between keywordColor and both text color and background
  • Try gold (rgba(255, 215, 0, 1)) for high visibility
  • Ensure alpha channel is 1.0 (fully opaque) for keyword color
  • Test on actual video backgrounds, not just specs
  • Use complementary colors (e.g., blue keywords on orange background)
Problem: Nearly every word is highlighted, reducing impact.Solution:
  • Simplify your text - use fewer, more impactful words
  • The AI highlights based on importance; simpler text = clearer keywords
  • Remove redundant adjectives and adverbs
  • Focus on one key concept per sentence
  • Consider not using highlighting for that particular content
Problem: Similar content highlighted differently in different scenes.Solution:
  • AI analyzes each scene independently - this is expected behavior
  • Ensure consistent phrasing for concepts you want highlighted
  • Use similar sentence structures across scenes
  • Capitalize important terms consistently
  • If needed, use same text multiple times for consistency
Problem: Want subtitles on some scenes but not others.Solution:
  • Use hideSubtitles: true on scenes where you don’t want subtitles
  • Combine with highlightKeywords: false for clarity
  • Useful for intro/outro scenes, transitions, or visual-only segments
  • Can also set different subtitle styles per scene
  • Test to ensure smooth visual transitions between scenes

Next Steps

Explore more subtitle and branding features:

API Reference

For complete technical details, see: