Detect scene changes in videos

Automatically find scene cuts, transitions, and fades in video files.

Video · Notebook · Updated

Colab runs it in your browser. If it calls a model provider, it asks for that provider's API key in a cell.

How it works

Three built-in detection methods handle different transition types using PySceneDetect.

What it covers

  • Detect hard cuts with scene_detect_content()
  • Find fade transitions with scene_detect_threshold()
  • Use adaptive detection with scene_detect_adaptive()

What it uses

Install
terminal
pip install pixeltable scenedetect opencv-python
Pixeltable calls
pxt.create_table()insert()add_computed_column()

A look at the code

video-scene-detection.ipynb
# Detect scenes using content-based detection (best for hard cuts)
videos.add_computed_column(
scenes_content=videos.video.scene_detect_content(
threshold=27.0, # Lower = more sensitive
min_scene_len=15, # Minimum frames between cuts
)
)
# View detected scenes
videos.select(videos.title, videos.scenes_content).collect()

One cell of the notebook, copied as it is. Open it in Colab for the rest.

Browse all 103