distant-frames 0.2.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of distant-frames might be problematic. Click here for more details.
- {distant_frames-0.2.0 → distant_frames-0.2.2}/.github/workflows/publish.yml +2 -2
- {distant_frames-0.2.0 → distant_frames-0.2.2}/PKG-INFO +17 -14
- {distant_frames-0.2.0 → distant_frames-0.2.2}/README.md +15 -13
- {distant_frames-0.2.0 → distant_frames-0.2.2}/RELEASE_NOTES.md +7 -1
- {distant_frames-0.2.0 → distant_frames-0.2.2}/distant_frames/core.py +5 -2
- {distant_frames-0.2.0 → distant_frames-0.2.2}/pyproject.toml +2 -1
- {distant_frames-0.2.0 → distant_frames-0.2.2}/uv.lock +1 -1
- {distant_frames-0.2.0 → distant_frames-0.2.2}/.github/workflows/ci.yml +0 -0
- {distant_frames-0.2.0 → distant_frames-0.2.2}/.gitignore +0 -0
- {distant_frames-0.2.0 → distant_frames-0.2.2}/.python-version +0 -0
- {distant_frames-0.2.0 → distant_frames-0.2.2}/CONTRIBUTING.md +0 -0
- {distant_frames-0.2.0 → distant_frames-0.2.2}/LICENSE +0 -0
- {distant_frames-0.2.0 → distant_frames-0.2.2}/PUBLISHING.md +0 -0
- {distant_frames-0.2.0 → distant_frames-0.2.2}/distant_frames/__init__.py +0 -0
- {distant_frames-0.2.0 → distant_frames-0.2.2}/distant_frames/cli.py +0 -0
- {distant_frames-0.2.0 → distant_frames-0.2.2}/extracted_frames/.gitkeep +0 -0
- {distant_frames-0.2.0 → distant_frames-0.2.2}/generate_test_video.py +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: distant-frames
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Smart video frame extraction tool
|
|
5
5
|
Project-URL: Homepage, https://github.com/yubraaj11/distant-frames
|
|
6
6
|
Project-URL: Repository, https://github.com/yubraaj11/distant-frames
|
|
7
7
|
Project-URL: Issues, https://github.com/yubraaj11/distant-frames/issues
|
|
8
|
+
Project-URL: ReleaseNotes, https://github.com/yubraaj11/distant-frames/blob/main/RELEASE_NOTES.md
|
|
8
9
|
Author-email: Yubraj Sigdel <yubrajsigdel1@gmail.com>
|
|
9
10
|
License: GPL-3.0-or-later
|
|
10
11
|
License-File: LICENSE
|
|
@@ -21,6 +22,12 @@ Requires-Dist: opencv-python>=4.10.0
|
|
|
21
22
|
Requires-Dist: typer>=0.9.0
|
|
22
23
|
Description-Content-Type: text/markdown
|
|
23
24
|
|
|
25
|
+

|
|
26
|
+

|
|
27
|
+

|
|
28
|
+

|
|
29
|
+

|
|
30
|
+
|
|
24
31
|
# Distant Frames
|
|
25
32
|
|
|
26
33
|
**Distant Frames** is a smart video frame extraction tool designed to capture distinct visual moments from video files. Instead of simply saving every Nth frame, it analyzes the visual similarity between consecutive potential frames and only saves those that are sufficiently different.
|
|
@@ -68,11 +75,12 @@ For development or to use the latest unreleased features:
|
|
|
68
75
|
|
|
69
76
|
## 💻 Usage
|
|
70
77
|
|
|
71
|
-
###
|
|
72
|
-
|
|
78
|
+
### Command Line Interface
|
|
79
|
+
|
|
80
|
+
Once installed, you can use the `distant-frames` command from anywhere:
|
|
73
81
|
|
|
74
82
|
```bash
|
|
75
|
-
|
|
83
|
+
distant-frames path/to/video.mp4 -o path/to/output -t 0.75
|
|
76
84
|
```
|
|
77
85
|
|
|
78
86
|
### Options
|
|
@@ -80,24 +88,19 @@ uv run distant_frames/cli.py path/to/your/video.mp4
|
|
|
80
88
|
| Argument | Description | Default |
|
|
81
89
|
|----------|-------------|---------|
|
|
82
90
|
| `video_path` | Path to the input video file (Required). | N/A |
|
|
83
|
-
| `--output` | Directory to save the extracted frames. | `extracted_frames` |
|
|
84
|
-
| `--threshold` |
|
|
91
|
+
| `--output`, `-o` | Directory to save the extracted frames. | `extracted_frames` |
|
|
92
|
+
| `--threshold`, `-t` | Defines the similarity score threshold (0.0 to 1.0) between frames. If the similarity score is **higher** than this value, the frame will be discarded. | `0.65` |
|
|
85
93
|
|
|
86
94
|
### Examples
|
|
87
95
|
|
|
88
96
|
**Extract frames with default settings:**
|
|
89
97
|
```bash
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
**Save to a custom folder with a stricter similarity check (fewer frames):**
|
|
94
|
-
```bash
|
|
95
|
-
uv run distant_frames/cli.py my_vacation.mp4 --output best_shots --threshold 0.95
|
|
98
|
+
distant-frames my_vacation.mp4
|
|
96
99
|
```
|
|
97
100
|
|
|
98
|
-
**Save
|
|
101
|
+
**Save to a custom folder with a stricter similarity check:**
|
|
99
102
|
```bash
|
|
100
|
-
|
|
103
|
+
distant-frames my_vacation.mp4 -o best_shots -t 0.95
|
|
101
104
|
```
|
|
102
105
|
|
|
103
106
|
## 🔍 How It Works
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+

|
|
2
|
+

|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
1
7
|
# Distant Frames
|
|
2
8
|
|
|
3
9
|
**Distant Frames** is a smart video frame extraction tool designed to capture distinct visual moments from video files. Instead of simply saving every Nth frame, it analyzes the visual similarity between consecutive potential frames and only saves those that are sufficiently different.
|
|
@@ -45,11 +51,12 @@ For development or to use the latest unreleased features:
|
|
|
45
51
|
|
|
46
52
|
## 💻 Usage
|
|
47
53
|
|
|
48
|
-
###
|
|
49
|
-
|
|
54
|
+
### Command Line Interface
|
|
55
|
+
|
|
56
|
+
Once installed, you can use the `distant-frames` command from anywhere:
|
|
50
57
|
|
|
51
58
|
```bash
|
|
52
|
-
|
|
59
|
+
distant-frames path/to/video.mp4 -o path/to/output -t 0.75
|
|
53
60
|
```
|
|
54
61
|
|
|
55
62
|
### Options
|
|
@@ -57,24 +64,19 @@ uv run distant_frames/cli.py path/to/your/video.mp4
|
|
|
57
64
|
| Argument | Description | Default |
|
|
58
65
|
|----------|-------------|---------|
|
|
59
66
|
| `video_path` | Path to the input video file (Required). | N/A |
|
|
60
|
-
| `--output` | Directory to save the extracted frames. | `extracted_frames` |
|
|
61
|
-
| `--threshold` |
|
|
67
|
+
| `--output`, `-o` | Directory to save the extracted frames. | `extracted_frames` |
|
|
68
|
+
| `--threshold`, `-t` | Defines the similarity score threshold (0.0 to 1.0) between frames. If the similarity score is **higher** than this value, the frame will be discarded. | `0.65` |
|
|
62
69
|
|
|
63
70
|
### Examples
|
|
64
71
|
|
|
65
72
|
**Extract frames with default settings:**
|
|
66
73
|
```bash
|
|
67
|
-
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**Save to a custom folder with a stricter similarity check (fewer frames):**
|
|
71
|
-
```bash
|
|
72
|
-
uv run distant_frames/cli.py my_vacation.mp4 --output best_shots --threshold 0.95
|
|
74
|
+
distant-frames my_vacation.mp4
|
|
73
75
|
```
|
|
74
76
|
|
|
75
|
-
**Save
|
|
77
|
+
**Save to a custom folder with a stricter similarity check:**
|
|
76
78
|
```bash
|
|
77
|
-
|
|
79
|
+
distant-frames my_vacation.mp4 -o best_shots -t 0.95
|
|
78
80
|
```
|
|
79
81
|
|
|
80
82
|
## 🔍 How It Works
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# Release Notes
|
|
2
2
|
|
|
3
|
-
## Version 0.2.
|
|
3
|
+
## Version 0.2.1
|
|
4
|
+
|
|
5
|
+
### Updated File Name
|
|
6
|
+
|
|
7
|
+
- **Concise Filenames**: Extracted frames now use a shortened 8-character UUID (e.g., `_frame_a1b2c3d4.jpg`) instead of the full 32-character UUID. This ensures uniqueness while keeping filenames cleaner and easier to manage.
|
|
8
|
+
|
|
9
|
+
## Version 0.2.0
|
|
4
10
|
|
|
5
11
|
### 🎨 Enhanced CLI Interface
|
|
6
12
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import cv2
|
|
2
2
|
import os
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import uuid
|
|
3
5
|
|
|
4
6
|
def calculate_similarity(frame1, frame2):
|
|
5
7
|
"""Calculates similarity between two frames using Histogram Correlation.
|
|
@@ -62,7 +64,8 @@ def extract_frames(video_path, output_folder, threshold=0.65):
|
|
|
62
64
|
if not os.path.exists(output_folder):
|
|
63
65
|
os.makedirs(output_folder)
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
video_file_name = Path(video_path).stem
|
|
68
|
+
cap = cv2.VideoCapture(str(video_path))
|
|
66
69
|
if not cap.isOpened():
|
|
67
70
|
print("Error: Could not open video.")
|
|
68
71
|
return
|
|
@@ -129,7 +132,7 @@ def extract_frames(video_path, output_folder, threshold=0.65):
|
|
|
129
132
|
skip_reference_timestamp = last_saved_timestamp
|
|
130
133
|
|
|
131
134
|
if should_save:
|
|
132
|
-
output_filename = os.path.join(output_folder, f"
|
|
135
|
+
output_filename = os.path.join(output_folder, f"{video_file_name}_frame_{uuid.uuid4().hex[:8]}.jpg")
|
|
133
136
|
cv2.imwrite(output_filename, frame)
|
|
134
137
|
|
|
135
138
|
# Update last saved frame
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "distant-frames"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.2"
|
|
4
4
|
description = "Smart video frame extraction tool"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -27,6 +27,7 @@ dependencies = [
|
|
|
27
27
|
Homepage = "https://github.com/yubraaj11/distant-frames"
|
|
28
28
|
Repository = "https://github.com/yubraaj11/distant-frames"
|
|
29
29
|
Issues = "https://github.com/yubraaj11/distant-frames/issues"
|
|
30
|
+
ReleaseNotes = "https://github.com/yubraaj11/distant-frames/blob/main/RELEASE_NOTES.md"
|
|
30
31
|
|
|
31
32
|
[project.scripts]
|
|
32
33
|
distant-frames = "distant_frames.cli:app"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|