> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pictory.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Highlight Keywords

> Emphasize important words in subtitles with automatic AI-powered keyword highlighting

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

<CardGroup cols={2}>
  <Card title="Keyword Highlighting" icon="highlighter">
    Automatically emphasize important words
  </Card>

  <Card title="AI Detection" icon="wand-magic-sparkles">
    AI identifies key terms automatically
  </Card>

  <Card title="Scene Control" icon="eye-slash">
    Show or hide subtitles per scene
  </Card>

  <Card title="Style Integration" icon="palette">
    Works with any subtitle style
  </Card>
</CardGroup>

## Before You Begin

Make sure you have:

* A [Pictory API key](https://app.pictory.ai/api-access)
* Node.js or Python installed on your machine
* Basic understanding of subtitle styling
* Content with keywords worth highlighting

<CodeGroup>
  ```bash npm theme={null}
  npm install axios
  ```

  ```bash pip theme={null}
  pip install requests
  ```
</CodeGroup>

## 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

<Note>
  Keyword highlighting uses AI to automatically identify important words. You do not need to manually specify which words to highlight - the AI determines this based on content analysis.
</Note>

## Complete Example

<CodeGroup>
  ```javascript Node.js theme={null}
  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();
  ```

  ```python Python theme={null}
  import requests
  import time
  import json

  API_BASE_URL = 'https://api.pictory.ai/pictoryapis'
  API_KEY = 'YOUR_API_KEY'

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

  def create_video_with_keyword_highlighting():
      try:
          print("Creating video with keyword highlighting...")

          response = requests.post(
              f'{API_BASE_URL}/v2/video/storyboard/render',
              json={
                  '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
              }
          )
          response.raise_for_status()

          job_id = response.json()['data']['jobId']
          print("✓ Video creation started!")
          print(f"Job ID: {job_id}")

          # Monitor progress
          print("\nMonitoring video creation...")
          job_completed = False
          job_result = None

          while not job_completed:
              status_response = requests.get(
                  f'{API_BASE_URL}/v1/jobs/{job_id}',
                  headers={'Authorization': API_KEY}
              )
              status_response.raise_for_status()

              status = status_response.json()['data']['status']
              print(f"Status: {status}")

              if status == 'completed':
                  job_completed = True
                  job_result = status_response.json()
                  print("\n✓ Video with keyword highlighting is ready!")
                  print(f"Video URL: {job_result['data']['videoURL']}")
              elif status == 'failed':
                  raise Exception(f"Video creation failed: {status_response.json()}")

              time.sleep(5)

          return job_result

      except requests.exceptions.RequestException as error:
          print(f"Error: {error}")
          if hasattr(error, 'response') and error.response is not None:
              print(f"Response: {error.response.text}")
          raise

  if __name__ == '__main__':
      create_video_with_keyword_highlighting()
  ```
</CodeGroup>

## Understanding the Parameters

### Scene-Level Parameters

| Parameter           | Type    | Default | Description                                           |
| ------------------- | ------- | ------- | ----------------------------------------------------- |
| `highlightKeywords` | boolean | false   | Enable/disable AI keyword highlighting for this scene |
| `hideSubtitles`     | boolean | false   | Show/hide all subtitles for this scene                |

### Required Style Property

| Parameter                    | Type   | Description                                                        |
| ---------------------------- | ------ | ------------------------------------------------------------------ |
| `subtitleStyle.keywordColor` | string | RGBA color for highlighted keywords (e.g., `rgba(255, 215, 0, 1)`) |

<Warning>
  **Keyword Color Required:** You must define `keywordColor` in your `subtitleStyle` for highlighting to be visible. Without this color specification, keywords will not appear different from regular text.
</Warning>

## What Gets Highlighted

The AI automatically identifies and highlights:

| Word Type              | Examples                             | Typical Highlighting           |
| ---------------------- | ------------------------------------ | ------------------------------ |
| **Key Nouns**          | AI, educators, social media, content | Important subjects and objects |
| **Action Verbs**       | impact, automate, enhance, create    | Significant actions            |
| **Important Concepts** | generation, consistency, efficiency  | Core ideas                     |
| **Product Names**      | Brand names, specific products       | Proper nouns                   |
| **Numbers**            | Statistics, percentages, quantities  | Numerical data                 |
| **Call-to-Action**     | subscribe, buy, learn, join          | Action words                   |

<Tip>
  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.
</Tip>

## Common Use Cases

### Educational Content with Key Terms

```javascript theme={null}
{
  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

```javascript theme={null}
{
  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

```javascript theme={null}
{
  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

```javascript theme={null}
{
  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

<AccordionGroup>
  <Accordion title="Choose Contrasting Keyword Colors">
    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
  </Accordion>

  <Accordion title="Use Highlighting Strategically">
    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
  </Accordion>

  <Accordion title="Write Content for 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
  </Accordion>

  <Accordion title="Test Highlighting Results">
    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 is not effective
  </Accordion>

  <Accordion title="Combine with Other Features">
    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
  </Accordion>
</AccordionGroup>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Keywords Are Not Being Highlighted">
    **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
  </Accordion>

  <Accordion title="Wrong words are highlighted">
    **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
  </Accordion>

  <Accordion title="Keyword color not visible">
    **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)
  </Accordion>

  <Accordion title="Too many words highlighted">
    **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
  </Accordion>

  <Accordion title="Highlighting inconsistent across scenes">
    **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
  </Accordion>

  <Accordion title="Need to hide subtitles for some scenes">
    **Problem:** Want subtitles on some scenes but not others.

    **Solution:**

    * Use `hideSubtitles: true` on scenes where you do not 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
  </Accordion>
</AccordionGroup>

## Next Steps

Explore more subtitle and branding features:

<CardGroup cols={2}>
  <Card title="Custom Subtitle Style" icon="font" href="/guides/branding-customization/custom-subtitle-style">
    Create fully custom subtitle styles
  </Card>

  <Card title="Subtitle Styles" icon="closed-captioning" href="/guides/branding-customization/subtitle-styles">
    Use saved subtitle style presets
  </Card>

  <Card title="Brand Settings" icon="palette" href="/guides/branding-customization/brand-settings">
    Apply complete brand presets
  </Card>

  <Card title="Custom Captions" icon="closed-captioning" href="/guides/text-to-video/text-to-video-captions">
    Add custom or translated captions
  </Card>
</CardGroup>

## API Reference

For complete technical details, see:

* [Render Storyboard Video](/api-reference/videos/render-storyboard-video) - Full API specification
* [Get Job Status](/api-reference/jobs/get-video-render-job-by-id) - Monitor job status and progress
