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.

@@ -2,8 +2,8 @@ name: Publish to PyPI
2
2
 
3
3
  on:
4
4
  push:
5
- tags:
6
- - 'v*.*.*'
5
+ branches:
6
+ - main
7
7
 
8
8
  jobs:
9
9
  build-and-publish:
@@ -1,10 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: distant-frames
3
- Version: 0.2.0
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
+ ![PyPI - Version](https://img.shields.io/pypi/v/distant-frames)
26
+ ![PyPI - Status](https://img.shields.io/pypi/status/distant-frames)
27
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/distant-frames)
28
+ ![PyPI - Downloads](https://img.shields.io/pypi/dm/distant-frames)
29
+ ![GitHub License](https://img.shields.io/github/license/yubraaj11/distant-frames)
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
- ### Basic Command
72
- Run the script by providing the path to your video file:
78
+ ### Command Line Interface
79
+
80
+ Once installed, you can use the `distant-frames` command from anywhere:
73
81
 
74
82
  ```bash
75
- uv run distant_frames/cli.py path/to/your/video.mp4
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` | Similarity threshold (0.0 to 1.0). Frames with similarity **higher** than this value compared to the last saved frame will be **dropped**. | `0.65` |
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
- uv run distant_frames/cli.py my_vacation.mp4
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 more frames (looser similarity check):**
101
+ **Save to a custom folder with a stricter similarity check:**
99
102
  ```bash
100
- uv run distant_frames/cli.py my_vacation.mp4 --output all_shots --threshold 0.6
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
+ ![PyPI - Version](https://img.shields.io/pypi/v/distant-frames)
2
+ ![PyPI - Status](https://img.shields.io/pypi/status/distant-frames)
3
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/distant-frames)
4
+ ![PyPI - Downloads](https://img.shields.io/pypi/dm/distant-frames)
5
+ ![GitHub License](https://img.shields.io/github/license/yubraaj11/distant-frames)
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
- ### Basic Command
49
- Run the script by providing the path to your video file:
54
+ ### Command Line Interface
55
+
56
+ Once installed, you can use the `distant-frames` command from anywhere:
50
57
 
51
58
  ```bash
52
- uv run distant_frames/cli.py path/to/your/video.mp4
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` | Similarity threshold (0.0 to 1.0). Frames with similarity **higher** than this value compared to the last saved frame will be **dropped**. | `0.65` |
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
- uv run distant_frames/cli.py my_vacation.mp4
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 more frames (looser similarity check):**
77
+ **Save to a custom folder with a stricter similarity check:**
76
78
  ```bash
77
- uv run distant_frames/cli.py my_vacation.mp4 --output all_shots --threshold 0.6
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.0 (Upcoming)
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
- cap = cv2.VideoCapture(video_path)
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"frame_{timestamp:.2f}.jpg")
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.0"
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"
@@ -25,7 +25,7 @@ wheels = [
25
25
 
26
26
  [[package]]
27
27
  name = "distant-frames"
28
- version = "0.2.0"
28
+ version = "0.2.2"
29
29
  source = { editable = "." }
30
30
  dependencies = [
31
31
  { name = "opencv-python" },
File without changes