ai_qc/backend/visual_qc_apps/video_visual_quality/app.py
nickviljoen 20259dcad0 Add Honda client, video QC, session refresh, Amazon check tuning
- Add Honda client with static_general and video_general profiles
- Add video QC capability using Gemini native video analysis (4 checks:
  visual_quality, brand_consistency, text_legibility, pacing_flow)
- Add video_general profile assigned to all 8 clients
- Extend session lifetime with MSAL silent token refresh (proactive
  every 45min + reactive on expiry), switch cache to localStorage
- Re-enable OCR layout measurements for Amazon checks
- Add scope boundary notes to all 6 Amazon checks to prevent cross-
  check penalization (locale errors isolated to logo_country only)
- Relax margins left-alignment tolerance from 1% to 4% to account
  for logo lockup internal padding
- Update brand guidelines DB with Amazon localization matrix and
  processed Dove PDF summary

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 14:53:52 +02:00

91 lines
3.9 KiB
Python

import os
import sys
# Add parent directory to path to import shared modules
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from visual_qc_apps.flask_app_template import FlaskAppTemplate
class VideoVisualQualityApp(FlaskAppTemplate):
"""
Video QC - Visual Quality Check
Evaluates overall visual quality of video content including resolution,
colour grading, exposure, focus, and technical artifacts.
"""
def __init__(self):
prompt = """You are performing a visual quality-control check on a VIDEO marketing asset. You are watching the full video — analyse it across its entire duration.
VIDEO VISUAL QUALITY EVALUATION:
Evaluate the following aspects across the entire video:
1. RESOLUTION & CLARITY:
- Is the video sharp and clear throughout, or are there soft/blurry segments?
- Are there any visible compression artifacts (blockiness, banding, mosquito noise)?
- Is the resolution appropriate for the intended use (e.g. social, broadcast, digital display)?
2. COLOUR & EXPOSURE:
- Is the colour grading consistent throughout the video?
- Are there any unintended colour shifts between scenes/shots?
- Is the exposure appropriate — no blown-out highlights or crushed shadows?
- Do brand colours appear accurate and consistent?
3. FOCUS & STABILITY:
- Are key subjects in focus throughout?
- Is there any unwanted camera shake or instability?
- Are intentional focus pulls/transitions executed cleanly?
4. TECHNICAL ARTIFACTS:
- Are there any frame drops, stuttering, or judder?
- Are there any visible encoding artifacts (especially at scene transitions)?
- Are there any black frames, flash frames, or unintended blank sections?
- Any visible green-screen or compositing edge issues?
5. AUDIO-VISUAL SYNC (if audio is present):
- Does the audio appear to sync with visual elements (lip sync, sound effects, music beats)?
- Note: You may not be able to hear audio, but note if lip movements appear mismatched with expected speech timing.
STEPS TO EVALUATE:
1. Watch the entire video and note any visual quality issues
2. Pay special attention to scene transitions and the opening/closing frames
3. Check for consistency in colour and exposure across the full duration
4. Note any technical artifacts or quality drops at specific moments
5. Assess whether the overall visual quality meets professional marketing standards
DECISION CRITERIA:
- PASS (score 7-10): Video is sharp, well-exposed, consistent colour, no visible artifacts
- MODERATE ISSUES (score 4-6): Minor quality issues — slight softness, minor colour inconsistency, or small artifacts that most viewers would not notice
- FAIL (score 1-3): Significant quality issues — blurry footage, visible artifacts, colour shifts, frame drops, or technical problems that undermine the professional appearance
YOUR OUTPUT:
Format your response as JSON:
{
"visual_quality_check": "Pass" or "Fail",
"resolution_clarity": {
"assessment": "Sharp/Clear" or "Slightly soft" or "Blurry/Low quality",
"compression_artifacts": true or false,
"notes": "Details"
},
"colour_exposure": {
"colour_consistency": "Consistent" or "Minor shifts" or "Inconsistent",
"exposure": "Good" or "Slightly over/under" or "Poor",
"notes": "Details"
},
"stability_focus": {
"focus_quality": "Sharp" or "Occasionally soft" or "Poor",
"stability": "Stable" or "Minor shake" or "Unstable",
"notes": "Details"
},
"technical_issues": ["List any artifacts, frame drops, or technical problems found. Empty array if none."],
"video_duration_assessed": "Approximate duration of the video",
"explanation": "Detailed reasoning for the overall assessment",
"recommendations": ["List specific recommendations if applicable, else an empty array"]
}"""
super().__init__(__name__, prompt)
# Run the app if executed directly
if __name__ == "__main__":
app_instance = VideoVisualQualityApp()
app_instance.run()