Skip to content

Conversation

mhafizazh
Copy link

@mhafizazh mhafizazh commented Jul 8, 2025

Adding Random Frame Extractor

Summary

summary...
add Random Frame Extractor

Description

This python based command prompt will help you generate n number of frame from a video as an input.

The changes are as follows:

  • add Random Frame Extractor/ directory
  • add changes in README.md

Checks

in the repository

  • Made no changes that degrades the functioning of the repository
  • [Gave each commit a better title (unlike updated README.md)

in the PR

  • Followed the format of the pull_request_template
  • Made the Pull Request in a small level (for the creator's wellfare)
  • Tested the changes you made

Thank You,

Hafiz Azhari

@mhafizazh
Copy link
Author

resolved #463

@DhanushNehru DhanushNehru requested a review from Copilot July 21, 2025 15:21
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new Random Frame Extractor utility that extracts a specified number of random frames from video files. The tool uses OpenCV to process videos and saves extracted frames as PNG images with unique identifiers.

  • Adds a complete Python script for random frame extraction with command-line interface
  • Updates the README.md table to document the new utility
  • Implements video processing with error handling and frame sampling logic

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.

File Description
Random Frame Extractor/RandomFrameExtractor.py Main implementation of the frame extraction utility with OpenCV
README.md Adds table entry documenting the new Random Frame Extractor tool

# Load video
cap = cv2.VideoCapture(video_path)
if not cap.isOpened():
print("Error: Could not open video.")
Copy link
Preview

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message should be more descriptive and include the video path to help users identify which file failed to open.

Suggested change
print("Error: Could not open video.")
print(f"Error: Could not open video at path: {video_path}")

Copilot uses AI. Check for mistakes.

save_idx += 1

frame_idx += 1
if save_idx > num_frames:
Copy link
Preview

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition should be save_idx > len(selected_frames) or removed entirely. The current logic could cause early termination when save_idx exceeds num_frames, but save_idx starts at 1 while num_frames represents the count.

Suggested change
if save_idx > num_frames:
if save_idx > len(selected_frames):

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant