
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Extracts frames from a video or processes images from a directory, scores them for sharpness, and selects the best frames based on various methods. This script is using the same selection methods as found in the Sharp Frames application by Reflct. For the full version, go to Sharp Frames, or join our Discord for access to the beta windows version.
opencv-python
) - Installed automatically with pippip install sharp-frames
Or use pipx for an isolated installation:
pipx install sharp-frames
Important: FFmpeg must be installed separately for video processing. The pip/pipx installation does NOT include FFmpeg.
ffmpeg.exe
to your PATH.brew install ffmpeg
sudo apt update && sudo apt install ffmpeg
sharp-frames --interactive # Interactive mode
sharp-frames <input_path> <output_directory> [options] # With arguments
<input_path>
: Path to the input video file or a directory containing image files (.jpg
, .jpeg
, .png
).<output_directory>
: Directory to save selected frames/images (will be created if it doesn't exist).--fps <int>
: Frames per second to extract (video input only, default: 10).--format <jpg|png>
: Output image format for saved files (default: jpg
).--width <int>
: Width to resize output images (height will be adjusted proportionally, 0 for no resizing, default: 0).--force-overwrite
: Overwrite existing files in the output directory without confirmation.--interactive
: Run in interactive mode, prompting for all options.Selection Method Options:
--selection-method <best-n|batched|outlier-removal>
: Choose the frame selection algorithm (default: best-n
).
For best-n
(default): Selects a target number of frames (--num-frames
) aiming for the sharpest images while maintaining a minimum distance (--min-buffer
) between selections. It uses a two-pass approach to balance sharpness and distribution across the source material.
--num-frames <int>
: Number of frames/images to select (default: 300).--min-buffer <int>
: Minimum frame index gap between selected items (default: 3).For batched
: Divides the frames/images into batches of a specified size (--batch-size
) and selects the single sharpest frame from each batch. A buffer (--batch-buffer
) can be added to skip frames between batches.
--batch-size <int>
: Number of frames/images in each analysis batch (default: 5). The best frame from each batch is selected.--batch-buffer <int>
: Number of frames/images to skip between batches (default: 2).For outlier-removal
: Analyzes each frame's sharpness relative to its neighbors within a window (--outlier-window-size
). Frames significantly less sharp than their neighbors (controlled by --outlier-sensitivity
) are considered outliers and are not selected. This method keeps all frames except those identified as outliers.
--outlier-window-size <int>
: Number of neighboring frames to compare against (default: 15, must be odd).--outlier-sensitivity <int>
: How aggressively to remove outliers (0-100, higher means more removal, default: 50).Ctrl+C
.sharp-frames my_video.mp4 ./selected_video_frames
(Extracts 10fps, selects 300 best frames with buffer 3)
sharp-frames ./image_folder ./selected_dir_images --num-frames 50 --min-buffer 1
(Processes images in ./image_folder
, selects the best 50 with buffer 1)
sharp-frames my_video.mp4 ./selected_batched --selection-method batched --batch-size 10 --batch-buffer 2
(Selects the best frame from batches of 10, skipping 2 frames between batches)
sharp-frames my_video.mp4 ./resized_frames --width 800
(Extracts frames at 10fps, resizes to 800px width while maintaining aspect ratio, selects 300 best frames)
sharp-frames ./image_folder ./selected_outliers --selection-method outlier-removal --outlier-sensitivity 75
(Processes images, removing frames considered outliers with 75% sensitivity)
sharp-frames --interactive
(Prompts for input path, output path, and all relevant options)
best-n
, batched
, or outlier-removal
algorithms.Ctrl+C
.fps
into a temporary directory.selection-method
and its parameters.selected_metadata.json
) with information about the input, selection parameters, and a list of selected items including their original index and sharpness score.FAQs
Extract, score, and select the best frames from a video or image directory
We found that sharp-frames demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.