Sportscode Building Blocks: Scripted Video Analysis with Sportscode Elite

Get your team analyzing opponent tendencies with interactive output reports in Sportscode Elite.

Sportscode Building Blocks: Scripted Video Analysis with Sportscode Elite

Get your team analyzing opponent tendencies with interactive output reports in Sportscode Elite.

About the Sportscode Building Blocks Series

The Sportscode Building Blocks blog series is intended to put tools in the hands of Sportscode users to increase the effectiveness of their Sportscode workflows and analysis. The examples used will be basic, with the intention of providing a foundation for the skills described in the examples. We’ll use sport-specific examples to demonstrate the techniques, but keep in mind: These examples can be applied to any sport or activity analyzed with Sportscode.

When trying to slow down one of the all-time greats, any advantage is worth exploring. That’s what led former Duke University and NBA player Shane Battier to turn to analytics when looking for clues in his defensive assignment guarding the Los Angeles Lakers’ Kobe Bryant.

In a recent interview with The Big Think, Battier said that during his playing days, using analytics made him a better defender and extended his professional career. Battier, who was named to the NBA All-Defensive team twice during his career, explained that in-game decisions he made were heavily influenced by data analysis of opponent performance.

He specifically cited how his pre-game analysis helped him discover that forcing Bryant into a certain direction on the court actually decreased the Lakers’ points per possession (PPP) by 10 percent.

Scripting with Sportscode

With Sportscode Elite, analysts and coaches can make data such as play direction and result come alive by linking data points to video with scripted buttons. Scripting is a Sportscode Elite feature which enables user-customized commands to interact with the data and video in Sportscode.

More specifically, scripting allows users to play back specific clips of data-linked video and display calculations based on input data as part of interactive output reports.

Distributing output reports with Sportscode and sharing data-linked video with Hudl are the most effective ways to get players like Battier interacting with video and analytics.

Create a Code Window to Track Play Types and Directions

To set up analysis workflows allowing opponent tendency research similar to Battier’s, the first step is to create a code window to attach that information to video. A simple way to start is by coding possessions and creating buttons to label each possession with play types and directions.

Left: Offense and defense possession code buttons, play type and direction label buttons. Right: Direction buttons pulled away from play type to show activation links.

Download the above code window for a closer look behind the scenes. 

Note: Since the code window includes activation links, it’ll only function properly in Sportscode Pro or Elite.

Script Action Buttons to Play Back Video

After fully coding video, building a scripted report requires creating a new code window that will be used as an output window. An output window is designed to play back video from a timeline (single game or database) by using action buttons.

Action buttons can be used in conjunction with scripts to play back specific video from the timeline when clicked. 

In the example below, three action buttons have been created: Right, High and Left. Using the script in the inspector window pictured below, each button has two functions:

  • Play back video for pick-and-roll plays in each direction.
  • Count and display the number of pick-and-roll plays in each direction.

Here’s a breakdown of the script above. Refer to the original code window for button names.

  • Any command starting with a “$” is considered a variable. Variables make referring to buttons much easier when scripting.
  • Every name within quotes is a button name, e.g., “OFFENSE”, referring to the “OFFENSE” code button, or “Right”, referring to the “Right” label button. Button names in your scripts must match the name in the code window, including spaces and capitalization.
  • After defining each variable with $direction, $playtype and $possession, the script refers to those variables instead of the button names.
  • The $output variable directs Sportscode to find every time the label button “Right” ($direction) and “PICK AND ROLL” ($playtype) were clicked during an “OFFENSE” possession ($possession) 
  • The show command plays back the video of each $output instance when the “Right” button is clicked in the output window.
  • Finally, the show count command directs Sportscode to display the number of times the conditions of the $output variable appear in the timeline data.

All that needs to be done to get the “High” and “Left” buttons functioning the same way is to copy and paste the script from the “Right” button into their respective Script tabs. Make sure to change the “Right” references in the script to “Left” or “High” after pasting.

Download this output window and double-click the action buttons while in Edit Mode to check out how the script is put together. Experiment with changing up the script to match the specific buttons you use in your game, practice or scout windows.

Synergy Output Windows

If you’re a Synergy subscriber, you can import your video and data into Sportscode with the Synergy import feature.

It’s easy to script for Synergy files, since Sportscode imports the data with consistent code and label names. 

Try this detailed output report for pick-and-roll plays using your own downloaded Synergy folder.

Get Started

We encourage you to experiment with scripting using the building block templates in this blog. Modifying the scripts to match your data and your objectives is a great way to get started.

If you don’t yet have Sportscode Elite, but would like to use scripted output windows in your analysis workflow, contact our staff.

Was this helpful? Send us an email with your feedback and questions.

Get in the Hudl   |   Expert advice and news from the world of video and performance analysis.