2025-12-02 18:54:14 +08:00

45 lines
3.4 KiB
Markdown

## MODIFIED Requirements
### Requirement: Video Content Analysis
The system SHALL provide functionality to analyze video content using Alibaba Cloud DashScope MultiModal API. The system SHALL extract video frames at a configurable fps rate. The system SHALL call the DashScope API with the video file using the correct local file path format (`file://{absolute_path}`) as specified in DashScope documentation. The system SHALL save the analysis results to MongoDB.
#### Scenario: Successful Video Analysis
- **WHEN** a user requests analysis for an uploaded video
- **THEN** the system SHALL read the video file from local storage
- **AND** the system SHALL construct the file path in the format `file://{absolute_path}` where `absolute_path` is the absolute path string of the video file
- **AND** the system SHALL call DashScope MultiModalConversation API with the correctly formatted file path and fps parameter (default: 2)
- **AND** the system SHALL receive the analysis result from the API
- **AND** the system SHALL save the analysis result to MongoDB with video_id, analysis_type, content, fps, and created_at
- **AND** the system SHALL update the video status to "analyzed"
- **AND** the system SHALL return the analysis result to the user
#### Scenario: Analysis API Failure
- **WHEN** the DashScope API call fails (network error, API error, invalid file path format, etc.)
- **THEN** the system SHALL handle the error gracefully
- **AND** the system SHALL update the video status to "failed"
- **AND** the system SHALL return an appropriate error message to the user
- **AND** the system SHALL log the error with detailed information for debugging
### Requirement: Video Summary Generation
The system SHALL provide functionality to generate a summary of video content. The system SHALL use the DashScope API to analyze the video using the correct local file path format (`file://{absolute_path}`) and generate a summary based on a predefined prompt template. The system SHALL save the summary to MongoDB.
#### Scenario: Successful Summary Generation
- **WHEN** a user requests a summary for an analyzed video
- **THEN** the system SHALL construct the file path in the format `file://{absolute_path}`
- **AND** the system SHALL call the DashScope API with the correctly formatted video file path and summary prompt
- **AND** the system SHALL receive the summary text from the API
- **AND** the system SHALL save the summary to MongoDB with video_id, summary_text, and created_at
- **AND** the system SHALL return the summary to the user
### Requirement: Video Comparison
The system SHALL provide functionality to compare content between multiple videos. The system SHALL extract content from each video using the correct local file path format (`file://{absolute_path}`). The system SHALL generate a comparison analysis highlighting similarities and differences. The system SHALL save the comparison result to MongoDB.
#### Scenario: Successful Video Comparison
- **WHEN** a user requests comparison between two or more videos
- **THEN** the system SHALL construct file paths for each video in the format `file://{absolute_path}`
- **AND** the system SHALL call the DashScope API with multiple correctly formatted video file paths and comparison prompt
- **AND** the system SHALL generate a comparison result
- **AND** the system SHALL save the comparison to MongoDB with video_ids, comparison_result, and created_at
- **AND** the system SHALL return the comparison result to the user