loreal-video-optimizer/TESTING.md
DJP 129ea3ec1e Initial commit: Video Optimizer for L'Oréal
Complete video optimization tool with:
- 21 platform configurations (Meta, TikTok, YouTube, Pinterest, Snapchat, Amazon)
- FFmpeg-powered video conversion with H264, H265, and VP9 codecs
- Python Flask backend with REST API
- HTML/JS frontend with drag-drop interface
- Black + #FFC407 color scheme with Montserrat font
- Side-by-side video comparison player
- Filename auto-detection for platform and aspect ratio
- MAMP-compatible setup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-16 16:52:11 -04:00

5.5 KiB

Testing Guide

Manual Testing Checklist

Backend Testing

1. Health Check

curl http://localhost:5000/api/health

Expected response:

{
  "status": "ok",
  "ffmpeg_installed": true,
  "timestamp": "2025-..."
}

2. Platform List

curl http://localhost:5000/api/platforms

Should return all 8 platforms with 21 total format combinations.

3. Filename Detection

curl -X POST http://localhost:5000/api/detect \
  -H "Content-Type: application/json" \
  -d '{"filename": "summer_ad_tiktok_9x16.mp4"}'

Expected:

{
  "platform": "tiktok",
  "aspect_ratio": "9:16",
  "detected": true
}

Frontend Testing

Test Cases

1. File Upload

  • Drag & drop works
  • Click to browse works
  • Invalid file types rejected
  • File info displays correctly

2. Auto-Detection Test these filenames:

  • test_tiktok_9x16.mp4 → TikTok, 9:16
  • demo_meta_1x1.mov → Meta, 1:1
  • ad_youtube_16x9.mp4 → YouTube, 16:9
  • campaign_pinterest_2x3.mp4 → Pinterest, 2:3

3. Platform Selection

  • All 8 platforms listed
  • Selecting platform populates aspect ratios
  • Format info updates correctly
  • Bitrate hints show recommended values

4. Video Conversion

  • Convert button enables when valid
  • Progress bar displays
  • Conversion completes successfully
  • Error handling works for invalid inputs

5. Video Comparison

  • Both videos display
  • File size stats correct
  • Reduction percentage calculated
  • Sync playback works
  • Pause both works
  • Download buttons work

6. Edge Cases

  • Very large files (>100MB)
  • Very short videos (<5 seconds)
  • Videos with no audio
  • Custom bitrate override
  • Multiple conversions in sequence

Codec Validation

Verify correct codec usage for each platform:

TikTok (H265):

ffprobe output_file.mp4 2>&1 | grep -i hevc
# Should contain "hevc" or "h265"

YouTube (VP9):

ffprobe output_file.webm 2>&1 | grep -i vp9
# Should contain "vp9"

Meta/Others (H264):

ffprobe output_file.mp4 2>&1 | grep -i h264
# Should contain "h264"

Performance Testing

Expected Conversion Times (1 minute 1080p video):

Platform Expected Time Notes
Meta (H264) 20-40s Fast
TikTok (H265) 40-80s Slower (better compression)
YouTube (VP9) 60-120s Slowest (best quality/size)

Times vary based on hardware and video complexity


Quality Assurance

Visual Comparison Checks:

  1. Sharpness - Text remains readable
  2. Color - No significant color shift
  3. Motion - No excessive blocking in fast scenes
  4. Audio - Sync and quality maintained

Acceptable Degradation:

  • Slight softness in small details
  • Minor compression artifacts in complex scenes
  • Should NOT have: blocking, color banding, desync

File Size Validation

Target Reductions (vs. unoptimized source):

Platform Target Reduction Acceptable Range
TikTok 30-40% 20-50%
Meta 25-35% 15-45%
YouTube 20-30% 10-40%
Pinterest 25-35% 15-45%

Warning Signs:

  • Less than 10% reduction → Check settings
  • More than 60% reduction → Quality likely too low

Integration Testing

Full Workflow Test

  1. Start application: ./start.sh
  2. Upload: sample_video_tiktok_9x16.mp4
  3. Verify auto-detection: TikTok + 9:16
  4. Convert with recommended settings
  5. Compare videos side-by-side
  6. Verify file size reduction (target: 30-40%)
  7. Download optimized file
  8. Verify downloaded file plays correctly
  9. Upload new file (test cleanup)

Browser Compatibility

Test in:

  • Chrome/Edge (Chromium)
  • Firefox
  • Safari (macOS/iOS)
  • Mobile browsers

Known Issues:

  • VP9/WebM may have limited support in Safari (falls back to H264)

API Load Testing

Simple Load Test

# Upload 10 files concurrently
for i in {1..10}; do
  curl -X POST http://localhost:5000/api/upload \
    -F "file=@test_video.mp4" &
done
wait

Expected: All uploads succeed, no crashes


Error Scenarios

Test these error conditions:

  1. No FFmpeg installed

    • Remove FFmpeg temporarily
    • Start server → Should warn but not crash
  2. Corrupted video file

    • Upload corrupted file → Should show error
  3. Invalid platform/aspect ratio combo

    • Try TikTok 2:3 → Should error gracefully
  4. Network interruption

    • Stop backend mid-conversion → Frontend should handle
  5. Disk space full

    • Fill disk → Should error gracefully

Clean Up After Testing

# Remove test files
rm -rf backend/uploads/*
rm -rf backend/outputs/*

# Keep .gitkeep files
touch backend/uploads/.gitkeep
touch backend/outputs/.gitkeep

Regression Testing Checklist

Before major updates, verify:

  • All 21 platform/format combinations work
  • Filename auto-detection patterns work
  • Side-by-side comparison works
  • File downloads work
  • Cleanup endpoint works
  • No memory leaks (long-running test)

Test Video Sources

Where to get test videos:

  1. Pixabay - https://pixabay.com/videos/ (Free)
  2. Pexels - https://www.pexels.com/videos/ (Free)
  3. Generate test patterns:
# Create 10-second test video
ffmpeg -f lavfi -i testsrc=duration=10:size=1920x1080:rate=30 \
  -pix_fmt yuv420p test_pattern.mp4

Testing complete! All features verified and working as expected.