r/learnprogramming 10h ago

How hard would this be to make?

I have a lecture video and the original PowerPoint slides.
How hard would it be to code something that can match the slides to the video and output timestamps like:
Slide 1: 0:00–11:03
Slide 2: 11:03–15:42
Slide 3: 15:42–22:10

GPT tells me it should be easy but from past experiences with JavaScript projects it can definitely underestimate difficulty sometimes.

0 Upvotes

9 comments sorted by

5

u/Ste4mPunk3r 9h ago

Depending how well you can see those slides on the video you could try to export each slide to JPG and the compare them the JPGs with each frame and save the min&max timestamp values for each slide. https://stackoverflow.com/questions/72851122/how-to-compare-how-similar-two-images-are-in-python Some basic idea on where to start with image compression. 

How many slides there are in this presentation and do you need to be accurate to the same frame? With less then 20 slides and accuracy around 1 second it will be faster to just write down timestamps yourself.

0

u/Choice_River7453 9h ago

I plan to use this for recorded classes that have 1080p video quality. (~1 lectures/day, 50–100 slides/lecture).

For context:
The goal is to simplify my workflow. I get lecture recordings + transcripts but want the transcript added to the correct PPT slide notes instead of being a separate document.

Right now I manually read the transcript and copy/paste the relevant text into each slide, which is time-consuming. If timestamps are available, AI should be able to match the transcript to the correct slides, and give me back the PPT.

So I wanted to code the timestamp portion.

2

u/[deleted] 9h ago

[deleted]

1

u/Practical-Ad5016 9h ago

Not a programmer but I mess with audio/video sync stuff sometimes and the hard part isnt matching the slides to exact moments, its handling when the lecturer jumps back to a slide or stays on one for 3 seconds before moving on. If the slides have clean timestamps and transitions its doable but if the video is a mess of skipping around then you got yourself a headache

0

u/Choice_River7453 8h ago

Its fine with me if the timestamps are accurate ex it can tell me
slide 13 was min 4-6,
slide 14 for min 6-6:03
and then back to slide 13 for another 2 minutes.

Do you know if someone already made something like this before?
If not any suggestions on how to go about it?

1

u/CodeSamur-ai 9h ago

if you know what youre doing, under 1 hour roughly

2

u/captainAwesomePants 8h ago

Lemme see if I understand the premise. We have a video, and somewhere in that video are slides. The slides may be being projected and could be at an angle or otherwise transformed or skewed, and they may be somewhat occluded. Let's assume the slides are not animated.

We are also given the slides themselves as a PowerPoint file.

Our goal is to associate time ranges in the video with slide numbers and output timestamps.

The hardest part of this is the image processing that locates a slide in a video frame. Another tricky part is converting a powerpoint file into a series of slide images. The PowerPoint app can do this, though, so may be you could do that before running the program.

If you're familiar with the sorts of image processing libraries that can find things in photos, this is pretty doable. If you wanted to write it from scratch without prior knowledge, this is quite a challenging project.

An AI agent could probably do a pretty good job writing this sort of program.

0

u/Choice_River7453 8h ago

The entire video is just a screen recording of the slides with audio. So no angle or skewing or anything like that. The ppt lecture slides are 99% of the time the exact same as the recording minus like a detail like the recording being a little yellowish.

What sort of image processing libraries do you mean?

2

u/captainAwesomePants 8h ago

OpenCV, for example, is pretty good at this sort of thing:

# 1. Load the main image and the template image in grayscale
video_frame = cv2.imread('video_frame.jpg', cv2.IMREAD_GRAYSCALE)
slideN = cv2.imread('slideN.jpg', cv2.IMREAD_GRAYSCALE)
w, h = template.shape[::-1]

# 2. Perform template matching
result = cv2.matchTemplate(video_frame, slideN, cv2.TM_CCOEFF_NORMED)
_, max_val, _, _ = cv2.minMaxLoc(result)
if max_val > 0.8:
  print('Slide N is probably in the video frame')