Basketball footage into highlight reels

Ten minutes of basketball became a 75-second highlight reel and a 30-second vertical cut that follows the play.

Input
Ten minutes from one courtside camera
Output
75-second recap and 30-second vertical cut

Inspect the results

Compare the two cuts from the same courtside recording. The wide reel keeps more of the court visible, while the portrait crop follows the play.

Highlight reel, 16:91:15
Vertical reel, 9:160:30
  1. Read metadata
  2. Find cutsNeeds Read metadata.
  3. Measure motionNeeds Read metadata.
  4. Speech to textNeeds Read metadata.
  5. Sample framesNeeds Read metadata.
  6. Rank playsNeeds Speech to text, Find cuts.
  7. Find players and ballNeeds Sample frames.
  8. Cut wide playsNeeds Rank plays, Measure motion.
  9. Cut tall playsNeeds Rank plays, Measure motion, Find players and ball.
  10. Build wide reelNeeds Rank plays, Find cuts, Cut wide plays.
  11. Build tall reelNeeds Rank plays, Find cuts, Cut tall plays.
  12. Publish reelsNeeds Build wide reel, Build tall reel.
What each step does
Read metadata
Reads the recording's duration, frame size and tracks.
Speech to text
Transcribes any announcer or commentary, in the language it detects.
Find cuts
Finds the camera cuts.
Measure motion
Marks small changes between frames, from which the templates tell live play from slow-motion replays.
Sample frames
Takes a frame every 0.75 seconds, in 30-second windows.
Find players and ball
Finds the players and the ball in each frame with an open D-FINE detector.
Rank plays
Gemini watches the game and ranks the plays worth showing, with a caption for each.
Cut wide plays
Cuts each play as a 1280×720 clip.
Cut tall plays
Cuts each play as a 1080×1100 clip whose window follows the ball, or else the players.
Build wide reel
Assembles the 75-second 16:9 reel with a title card, lower thirds and an end card.
Build tall reel
Assembles the 30-second 9:16 reel from the tall clips.
Publish reels
Returns playback URLs for both reels.

Source footage

Ten minutes of a Slovenian women's first league game from one courtside camera.

Adapt this pipeline

A hosted run of this example requires an organization with Pipelines and LLM steps enabled.