AI soccer highlight reels from a full match recording
I built a demo system that reads a 60 minute youth match recording and cuts a highlight reel of one team's goals, saves and chances, scored against events I verified by hand.
The problem
A club coordinator filmed every match with an auto-tracking sideline camera and wanted a weekly highlight reel of his own team from the raw 60 minute recording, without anyone sitting through the footage. The reel had to show his team's goals and chances, not the opponent's, and he needed a demo good enough to win committee approval.
How I built it
I built it as stacked layers so each fix could be added without disturbing what was already validated. Layers read the match structure from whistles and audio, work out which goalkeeper defends which side in each period, detect events with a video model on compressed 3 minute chunks, verify each event's outcome and attribute it to a team, then check it against crowd noise before FFmpeg cuts the reel from the original-quality video. I scored every version against events I verified by hand, frame by frame, on three full matches, and treated each mismatch as a pattern to fix in a layer, never as a timestamp to exclude.
What got hard
- The video model invents goals. Asked whether the ball entered the net, it hallucinated goals about half the time, and a three-vote consensus did not help because the votes agreed with each other.
I stopped trusting it for a goal verdict. Layers only upgrade a save or attempt to a goal under strict conditions (unanimous votes, our goalkeeper involved), never downgrade a detected goal, and the goalkeeper's jersey colour, which the model identified correctly in all five of my test cases, decides whose goal it was.
- On the first full match the early version reported the score as 2 to 13 when the real score was 7 to 2, because it had the goalkeeper side inverted and did not know teams change ends.
I added time-based field maps with side-swap detection, and a YOLO check of which goalkeeper stands on which side, so orientation no longer depends on the video model's left and right.
- Youth matches can have three periods. My first swap detector compared the start and end of the match, and in a three-period game both ends have the same orientation, so it found no swaps.
It now compares every adjacent block and finds period breaks from whistle audio (tonal energy in the whistle band), classifying each as a period change, a foul or the final whistle by the drop in noise afterwards and the gap to the next whistle. On the first match it found both swaps within about 17 seconds of my hand-verified times.
- Full 1080p chunks were 146 MB each and uploads to the video model kept hanging.
Analysis runs on a compressed copy (640p, about 9 MB per 3 minute chunk) while the final reel is cut from the original footage.
- A fast counter-attack goal at 02:54 was invisible to the chunk scan.
A targeted scan looks only at windows after defensive events near our goal that were followed by a crowd roar with no goal logged, and asks the model with a unanimous-vote rule. It found the goal at 02:52.
- Some upgraded goals had no crowd reaction at all.
A self-consistency layer removes any upgraded goal whose crowd spike is under 1.3 times baseline. On the first match it removed two false goals (ratios 0.64 and 1.03) and kept the real ones.
The result
Tuned on the first match, the final reel held all 7 of the client team's goals with no false ones, in 35 clips and 11.4 minutes. On the second match it found 5 of 5 goals with 2 false ones. A third match, with a single goal for the client's team, showed the limit: the run produced nine candidate goals for his team and only one was real. On a match with few goal events, precision on goal-versus-near-miss calls drops sharply, which sets the ceiling on what this approach can promise.
The ← and → keys turn the page too.