Skip to content

Latest commit

 

History

History
60 lines (53 loc) · 1.95 KB

README.md

File metadata and controls

60 lines (53 loc) · 1.95 KB

Find-Duplicate-Photos-Videos

Python code to find and display all the exact duplicate photos (images) and videos in a folder and delete them (optional).
Begins search at the current folder. Repeats it for all sub-directories as well.

All the duplicate Photos and Videos are displayed at the end of the program. Input "Y" to delete the duplicates.

Run commands

Type Run command
Photos python duplicate_exact_photos.py
Videos python duplicate_exact_videos.py

Or Run "duplicate_media_exact.bat" on a Windows system to run both programs sequentially (photos followed by videos).

Run Arguments

Argument Usage Default
folder Folder to begin the search. Subfolders are included. Current path
keep_largest Keep the file with the largest or smallest size among the duplicates. 1 for largest and 0 for smallest. 1: Keep largest
compare_size Photos are resized to this value for comparison.
Higher value compares more pixels but requires more RAM and runs slower.
300 gives accurate and fast results.

Requirements

This program requires Python with numpy, tqdm and CV2 libraries to function.
Run the following command to install the dependent libraries in the Python environment if they are not present already:

pip install -r requirements.txt

Finding Duplicates Logic

Photos are compared using pixel-wise comparison using cosine distance after setting them to a fixed size.
Videos are compared using pixel-wise comparisons using cosine distance on the first frame (with a fixed size) and by matching their frame length.