<h2 id="AI Video Stream Processing Capabilities">AI Video Stream Processing Capabilities <span className="tag_h2">On-App AI</span></h2>

<div style="marginTop: 20px;">
<video controls width="250">
  <source src="https://images.tuyacn.com/rms-static/bc4b5340-0fd1-11f0-9f57-5d628208d2a7-1743605393012.mp4?tyName=ai_video_highlight.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>
</div>

### Function Introduction

AI video stream processing capabilities primarily provide two core function modules: intelligent subject enhancement and intelligent audio processing.

### Intelligent Subject Enhancement

- **Function Description**: Supports intelligent recognition and visual enhancement of specific subjects such as pets and portraits.
- **Interaction Method**:
  - Users can independently select the subject category they wish to highlight.
  - The system automatically completes target tracking and visual optimization processing.

### Intelligent Audio Processing

- **Mixing Control**:
  - Visual interface for volume adjustment
  - Adjustable original sound/background music ratio (0-100% linear adjustment)
- **Output Options**:
  - Retain original sound
  - Background music only
  - Mixed audio output

### Interaction Process

```mermaid
sequenceDiagram
rect rgb(191, 223, 255)
    User->>Panel: 1. Upload video and set parameters (subject / background music / mix ratio)
    Panel->>App: 2. Initiate AI processing request (objectDetectForVideo + onVideoObjectDetectProgress)
    App->>App: 3. Process video stream (calculate progress in real time)
    App-->>Panel: 4. Return processing progress percentage
    Panel->>Panel: Display current progress
    App-->>Panel: 5. Return processed video URL
    Panel->>App: 6. Unregister listener (offVideoObjectDetectProgress)
    Panel->>App: Fetch first frame (fetchVideoThumbnails)
    App-->>Panel: Return first frame image
    Panel->>Panel: Display result video and thumbnail
end

rect rgb(200, 150, 255)
    Note right of Panel: User Interaction Layer
    Note left of App: AI Video Processing Service
end
```

### Considerations

- 1. Currently, subject selection only supports two categories: pets and portraits.
- 2. Mixing ratio range: 0%-100% (default is 50% for original video sound and 50% for background music).
- 3. **Code Practice** Please refer to [Video Stream Subject Highlighting Template Details](https://developer.tuya.com/en/miniapp-codelabs/codelabs/panel-ai-video-highlight/index.html#0).
