Skip to main content

Generates video highlights for an NBA player.

Project description

NBA Highlights Video Generator

Videos

Posted on NBA Full Play Highlights.

Author

Ronen Huang

Time Frame

August 2025 to Present

FFmpeg Build

Download from https://www.gyan.dev/ffmpeg/builds/.

How the Generator Works

  1. The user provides the full player name (as per NBA website), the date range, the team abbreviated (as per NBA website), and choices of what highlights to include. An example can be seen below.
    from nba_video_generator.search import generate_video
    
    jalen_green_assists_urls = generate_video(
        player_name="Jalen Green",
        date_start="2024-11-01", 
        date_end="2024-11-08",
        team="hou",
        FGM=False,
        FGA=False,
        ThreePM=False,
        ThreePA=False,
        OREB=False,
        DREB=False,
        REB=False, 
        AST=True,
        STL=False,
        BLK=False,
        TO=True,
        PF=False
    )
    
  2. The program crawls the NBA website for links to the box score involving the player team.
  3. The program crawls the team box score for links to the events involving the player.
  4. The program crawls the player events for links to the videos.

If field goals or personal fouls are selected as highlight, the corresponding ESPN play by play link is used to determine the times of those events. Then the NBA play by play link is crawled for the videos of those events.

The output returns a dictionary where the keys are the dates and the events are the sorted list of events (represented as a tuple of video url, quarter, and time). An example can be seen below.

{
    '2024-11-02':
        [
            (video url 1, '1', '8:12'),
            (video url 2, '3', '9:50'),
            (video url 3, '3', '8:52'),
            (video url 4, '3','2:38')
        ],
    '2024-11-04':
        [
            (video url 5, '3', '1:37'),
            (video url 6, '4', '11:28'),
            (video url 7, '4', '10:54'),
            (video url 8, '4', '10:28'),
            (video url 9, '4', '2:10'),
            (video url 10, '4', '1:34')
        ],
    ...
}

NBA Team Abbreviations

  • atl - Atlanta Hawks
  • bkn - Brooklyn Nets
  • bos - Boston Celtics
  • cha - Charlotte Hornets
  • chi - Chicago Bulls
  • cle - Cleveland Cavaliers
  • dal - Dallas Mavericks
  • den - Denver Nuggets
  • det - Detroit Pistons
  • gsw - Golden State Warriors
  • hou - Houston Rockets
  • ind - Indiana Pacers
  • lac - Los Angeles Clippers
  • lal - Los Angeles Lakers
  • mem - Memphis Grizzlies
  • mia - Miami Heat
  • mil - Milwaukee Bucks
  • min - Minnesota Timberwolves
  • nop - New Orleans Pelicans
  • nyk - New York Knicks
  • okc - Oklahoma City Thunder
  • orl - Orlando Magic
  • phi - Philadelphia 76ers
  • phx - Phoenix Suns
  • por - Portland Trail Blazers
  • sac - Sacramento Kings
  • sas - San Antonio Spurs
  • tor - Toronto Raptors
  • uta - Utah Jazz
  • was - Washington Wizards

How to Make Video From Event URLS

Once the dictionary of event urls are obtained from the generate_videos method, the user can make the MP4 video with the make_video method which takes parameters

  • video_urls - dictionary of event urls
  • base_name - name of video
  • fps - frame per second
  • preset - Choose from "ultrafast", "veryfast", "superfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo"
  • segment - how to create videos with "Whole", "Game" (one video per game), "Quarter" (one video per quarter), "Play" (one video per play)

An example can be seen below.

from nba_video_generator.search import make_video

make_video(
    video_urls=jalen_green_assists_urls,
    base_name="jalen_green_assists",
    fps=30, preset="ultrafast",
    segment="Whole"
)

Pipeline

The highlight video can now be made with the pipeline method where the users provides both player parameters and video parameters as dictionary.

from nba_video_generator.search import pipeline

player_params = {
    "date_start": "2025-10-25",
    "date_end": "2025-10-25",
    "FGM": False,
    "FGA": True,
    "ThreePM": False,
    "ThreePA": False,
    "OREB": False,
    "DREB": False,
    "REB": True,
    "AST": True,
    "STL": True,
    "BLK": True,
    "TO": True,
    "PF": True,
    "include_ft": True
}

video_params = {
    "fps": 30,
    "preset": 'ultrafast',
    "segment": 'Play',
    "include_caption": True,
    "ffmpeg_path": r"C:\Users\ronen\Documents\Projects\nba_video_generator\src\nba_video_generator\ffmpeg-2025-10-21-git-535d4047d3-essentials_build\bin\ffmpeg.exe"
}

name_team_base = [
    ("Kon Knueppel", "cha", "kon"),
    ("Joel Embiid", "phi", "embiid"),
    ("Bennedict Mathurin", "ind", "benn"),
    ("Cedric Coward", "mem", "cedric"),
    ("Javon Small", "mem", "javon"),
    ("Christian Braun", "den", "braun"),
    ("Devin Booker", "phx", "book")
]

pipeline(player_params, video_params, name_team_base)

Beta

The full play videos can also be made from the reliable play by play rather than the unreliable box score. This does not work for compilations yet.

from nba_video_generator.beta_search import pipeline

pipeline(
    [
        ("Booker", "2026-02-19", "phx"),
    ],
    {"ffmpeg_path": r"C:\Users\ronen\Documents\Projects\nba_video_generator\src\nba_video_generator\ffmpeg-2025-10-21-git-535d4047d3-essentials_build\bin\ffmpeg.exe"}
)

Project details


Release history Release notifications | RSS feed

This version

3.0.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nba_video_generator-3.0.3.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nba_video_generator-3.0.3-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file nba_video_generator-3.0.3.tar.gz.

File metadata

  • Download URL: nba_video_generator-3.0.3.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nba_video_generator-3.0.3.tar.gz
Algorithm Hash digest
SHA256 c4941ee2336161cec2bb119a6693b2fa75d0b88ff9fa4061906ab2e60d12778e
MD5 65d3fc000c4190d91b6546bbfabbfa86
BLAKE2b-256 c5b21d032e004b4299bc7591246ef1e04d85ae8f17ce0115d690e1a295701a62

See more details on using hashes here.

Provenance

The following attestation bundles were made for nba_video_generator-3.0.3.tar.gz:

Publisher: python-publish.yml on ronenh24/nba_video_generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nba_video_generator-3.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for nba_video_generator-3.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a91f439dd3a8b05a6039fc8f5ed109376b8b3b00a6447a9a0884cc710e2230bd
MD5 53adf122949fe14f9252ee70c8ad93df
BLAKE2b-256 eddc4b7bd339ac53ab7d0a45bc4654ad5ee7c79d1b0d779d76423a5cdbdeec3a

See more details on using hashes here.

Provenance

The following attestation bundles were made for nba_video_generator-3.0.3-py3-none-any.whl:

Publisher: python-publish.yml on ronenh24/nba_video_generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page