FFmpeg Command Breakdown for Extracting Slides from a PowerPoint Video

Command:

ffmpeg -i "PresentationVideo.mp4" -filter_complex "select=gt(scene\,0.2)" "slides/%04d.jpg" -vsync vfr

Explanation of Each Component:

1. ffmpeg

  • The command-line tool used for video and audio processing.

2. -i "PresentationVideo.mp4"

  • Specifies the input video file: PresentationVideo.mp4 (the recorded PowerPoint or slide presentation).

3. -filter_complex "select=gt(scene\,0.2)"

  • -filter_complex: Enables complex filtering.
  • select=gt(scene,0.2):
    • Uses the scene detection filter to extract frames when significant slide transitions occur.
    • scene is a built-in metric that detects the difference between consecutive frames.
    • gt(scene,0.2):
      • gt() (greater than) selects frames where the scene change metric exceeds 20% (0.2).
      • This ensures that only major slide transitions are captured, avoiding minor visual changes.

4. "slides/%04d.jpg"

  • Saves the extracted slides as .jpg images in the slides/ directory. You must create this directory before using the command, or it will not work
  • %04d ensures images are numbered sequentially (e.g., 0001.jpg, 0002.jpg).

5. -vsync vfr

  • Ensures that only variable frame rate (VFR) frames matching the scene filter are kept, preventing unnecessary duplicate frames.

Effect of Changing the Scene Threshold (scene value)

Scene Change ThresholdEffect
0.05 (5%)Many frames extracted, including minor slide changes (animations, small transitions).
0.1 (10%)Fewer frames, capturing most major slide changes.
0.2 (20%)Extracts only clear slide transitions, ignoring minor visual changes.
0.3 (30%)Very few frames, capturing only the most drastic slide transitions.

Example with a Lower Scene Change Value

ffmpeg -i "PresentationVideo.mp4" -filter_complex "select=gt(scene\,0.1)" "slides/%04d.jpg" -vsync vfr
  • This command captures more frequent slide changes, useful if the slides have animations or frequent minor transitions.

Key Takeaways:

  • Lower scene values (e.g., 0.05–0.1) → Extract more frames, including small slide changes.
  • Higher scene values (e.g., 0.2–0.3) → Extract fewer frames, focusing on major slide transitions.
  • Adjust the value based on the type of PowerPoint presentation (animated vs. static slides).

Leave a comment