Skip to content

Commit b37263a

Browse files
Kriti SahuKriti Sahu
authored andcommitted
fix: 🐛 fixed masking frame id issue
Skipping frames by using time to start video extraction input field and fetch the first frame to mask the video.
1 parent 6383d93 commit b37263a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

save_yl_slide.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#################### Setting up parameters ################
2323

24-
seconds = 1
24+
seconds = 1 #4 -> if there is scrolling (this is the best we can do to get from the moving scrollable contents like arpit bhayani's videos)
2525
fps = vidcap.get(cv2.CAP_PROP_FPS) # Gets the frames per second
2626
multiplier = fps * seconds
2727

@@ -33,6 +33,8 @@
3333
while success:
3434
frameId = int(round(vidcap.get(1))) #current frame number, rounded b/c sometimes you get frame intervals which aren't integers...this adds a little imprecision but is likely good enough
3535
success, image = vidcap.read()
36+
if frameId <= int(multiplier)*args['start']:
37+
continue
3638
if count==0:
3739
previous = image
3840
# Mask the area to ignore (because we are checking the changes between two frames),
@@ -52,7 +54,7 @@
5254
image[int(r[1]):int(r[1]+r[3]),int(r[0]):int(r[0]+r[2])] = (255, 255, 255)
5355
count =+ 1
5456

55-
if frameId % int(multiplier) == 0 and frameId > int(multiplier)*args['start']:
57+
if frameId % int(multiplier) == 0:
5658
if fl and image is not None:
5759
orig_imgs = []
5860
for i in range(nu):

0 commit comments

Comments
 (0)