From 4699841f1e2f6306a54fa2f45fc419b5a9d85d40 Mon Sep 17 00:00:00 2001 From: aria Date: Sat, 14 Jun 2025 01:10:00 +1000 Subject: [PATCH] feat: Get claude AI to generate and debug FPS measurement functionality --- CLAUDE.md | 78 +++++++++++++++++++++++++++++++ main.go | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 212 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..74307ef --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,78 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +This is a Go CLI application for video frame analysis and comparison. The project provides tools to count frames in videos, compare individual frames, analyze differences between two videos, and perform frame persistence analysis for single videos. + +## Core Architecture + +The application is built using: +- **CLI Framework**: urfave/cli/v3 for command-line interface +- **Video Processing**: AlexEidt/Vidio library for video file handling with FPS detection +- **Image Processing**: Standard Go image libraries for frame comparison + +### Main Components + +- **CLI Commands**: Five main commands for comprehensive frame analysis operations +- **Frame Comparison**: Pixel-level comparison with configurable tolerance using squared difference +- **Video Processing**: Frame-by-frame video analysis with streaming support and memory-efficient processing +- **Frame Persistence Analysis**: Detects consecutive duplicate frames and calculates persistence duration + +### Key Functions + +- `count_video_frames()`: Counts total frames in a video file +- `compare_frames()`: Compares two frames with tolerance-based difference detection +- `compare_frames_alt()`: Alternative frame comparison using exact pixel matching +- `countUniqueVideoFrames()`: Analyzes differences between corresponding frames in two videos +- `analyzeFramePersistence()`: **Main feature** - Analyzes frame persistence in single video with per-second statistics +- `isDiffUInt8WithTolerance()`: Pixel comparison with configurable tolerance threshold +- `imageToRGBA()`: Converts images to RGBA format for consistent processing + +## Development Commands + +### Build and Run +```bash +go build -o fps-go-brr . +./fps-go-brr [args] +``` + +### Testing +```bash +go test ./... +``` + +### Module Management +```bash +go mod tidy +go mod download +``` + +## CLI Usage + +Available commands: +- `count-frames