better-ffmpeg-progress 2.3.1__tar.gz → 2.4.0__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.
- {better_ffmpeg_progress-2.3.1 → better_ffmpeg_progress-2.4.0}/PKG-INFO +4 -1
- {better_ffmpeg_progress-2.3.1 → better_ffmpeg_progress-2.4.0}/README.md +4 -1
- {better_ffmpeg_progress-2.3.1 → better_ffmpeg_progress-2.4.0}/better_ffmpeg_progress/better_ffmpeg_progress.py +39 -37
- {better_ffmpeg_progress-2.3.1 → better_ffmpeg_progress-2.4.0}/better_ffmpeg_progress.egg-info/PKG-INFO +4 -1
- {better_ffmpeg_progress-2.3.1 → better_ffmpeg_progress-2.4.0}/setup.py +1 -1
- {better_ffmpeg_progress-2.3.1 → better_ffmpeg_progress-2.4.0}/LICENSE +0 -0
- {better_ffmpeg_progress-2.3.1 → better_ffmpeg_progress-2.4.0}/better_ffmpeg_progress/__init__.py +0 -0
- {better_ffmpeg_progress-2.3.1 → better_ffmpeg_progress-2.4.0}/better_ffmpeg_progress.egg-info/SOURCES.txt +0 -0
- {better_ffmpeg_progress-2.3.1 → better_ffmpeg_progress-2.4.0}/better_ffmpeg_progress.egg-info/dependency_links.txt +0 -0
- {better_ffmpeg_progress-2.3.1 → better_ffmpeg_progress-2.4.0}/better_ffmpeg_progress.egg-info/requires.txt +0 -0
- {better_ffmpeg_progress-2.3.1 → better_ffmpeg_progress-2.4.0}/better_ffmpeg_progress.egg-info/top_level.txt +0 -0
- {better_ffmpeg_progress-2.3.1 → better_ffmpeg_progress-2.4.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: better-ffmpeg-progress
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: Run FFmpeg & see percentage progress + ETA.
|
|
5
5
|
Home-page: https://github.com/CrypticSignal/better-ffmpeg-progress
|
|
6
6
|
Author: GitHub.com/CrypticSignal
|
|
@@ -168,3 +168,6 @@ The `run` method takes the following **optional** arguments:
|
|
|
168
168
|
[29/10/2024]
|
|
169
169
|
- [v2.3.0] Set `shell=True` to support piping.
|
|
170
170
|
- [v2.3.1] Kill FFmpeg process(es) on KeyboardInterrupt
|
|
171
|
+
|
|
172
|
+
[31/10/2024]
|
|
173
|
+
- [v2.4.0] Print FFmpeg stderr if better progress information cannot be shown.
|
|
@@ -149,4 +149,7 @@ The `run` method takes the following **optional** arguments:
|
|
|
149
149
|
|
|
150
150
|
[29/10/2024]
|
|
151
151
|
- [v2.3.0] Set `shell=True` to support piping.
|
|
152
|
-
- [v2.3.1] Kill FFmpeg process(es) on KeyboardInterrupt
|
|
152
|
+
- [v2.3.1] Kill FFmpeg process(es) on KeyboardInterrupt
|
|
153
|
+
|
|
154
|
+
[31/10/2024]
|
|
155
|
+
- [v2.4.0] Print FFmpeg stderr if better progress information cannot be shown.
|
|
@@ -79,15 +79,11 @@ class FfmpegProcess:
|
|
|
79
79
|
)
|
|
80
80
|
|
|
81
81
|
# -progress pipe:1 sends progress metrics to stdout AND -stats_period sets the period at which encoding progress/statistics are updated
|
|
82
|
-
|
|
83
|
-
self._ffmpeg_args.extend(
|
|
84
|
-
["-progress", "pipe:1", "-stats_period", "0.1", "-nostats"]
|
|
85
|
-
)
|
|
82
|
+
self._ffmpeg_args.extend(["-progress", "pipe:1", "-stats_period", "0.1"])
|
|
86
83
|
except Exception:
|
|
87
84
|
print(
|
|
88
|
-
f"Could not detect the duration of {self._input_filepath.name}. Percentage progress, ETA and estimated filesize will be unavailable
|
|
85
|
+
f"Could not detect the duration of '{self._input_filepath.name}'. Percentage progress, ETA and estimated filesize will be unavailable.\n",
|
|
89
86
|
)
|
|
90
|
-
self._duration_secs = None
|
|
91
87
|
|
|
92
88
|
def _check_output_exists(self) -> bool:
|
|
93
89
|
"""Check if output file exists and handle overwrite prompt."""
|
|
@@ -165,7 +161,9 @@ class FfmpegProcess:
|
|
|
165
161
|
if is_error:
|
|
166
162
|
return
|
|
167
163
|
|
|
168
|
-
print(
|
|
164
|
+
print(
|
|
165
|
+
f"{"\n\n" if self._duration_secs is None else ""}FFmpeg log filename: {log_file}"
|
|
166
|
+
)
|
|
169
167
|
|
|
170
168
|
def _start_process(
|
|
171
169
|
self,
|
|
@@ -173,12 +171,7 @@ class FfmpegProcess:
|
|
|
173
171
|
task_id: Optional[int],
|
|
174
172
|
progress_handler: Optional[Callable],
|
|
175
173
|
) -> None:
|
|
176
|
-
|
|
177
|
-
if os.name == "nt":
|
|
178
|
-
creationflags = subprocess.CREATE_NEW_PROCESS_GROUP
|
|
179
|
-
# macOS and Linux
|
|
180
|
-
else:
|
|
181
|
-
creationflags = 0
|
|
174
|
+
creationflags = subprocess.CREATE_NEW_PROCESS_GROUP if os.name == "nt" else 0
|
|
182
175
|
|
|
183
176
|
process = subprocess.Popen(
|
|
184
177
|
self._ffmpeg_args,
|
|
@@ -199,36 +192,41 @@ class FfmpegProcess:
|
|
|
199
192
|
|
|
200
193
|
try:
|
|
201
194
|
while process.poll() is None:
|
|
202
|
-
|
|
203
|
-
|
|
195
|
+
if self._duration_secs is not None:
|
|
196
|
+
try:
|
|
197
|
+
stdout = stdout_queue.get_nowait()
|
|
204
198
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
if (
|
|
209
|
-
metric in self.WANTED_METRICS
|
|
210
|
-
and value
|
|
211
|
-
and "N/A" not in value
|
|
212
|
-
):
|
|
213
|
-
self._update_metrics(
|
|
214
|
-
stdout, metric, value, progress_handler
|
|
215
|
-
)
|
|
199
|
+
if stdout:
|
|
200
|
+
metric, value = stdout.split("=")
|
|
216
201
|
|
|
217
202
|
if (
|
|
218
|
-
metric
|
|
219
|
-
and
|
|
220
|
-
and
|
|
203
|
+
metric in self.WANTED_METRICS
|
|
204
|
+
and value
|
|
205
|
+
and "N/A" not in value
|
|
221
206
|
):
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
completed=self._metrics.seconds_processed,
|
|
225
|
-
speed=self._metrics.speed,
|
|
207
|
+
self._update_metrics(
|
|
208
|
+
stdout, metric, value, progress_handler
|
|
226
209
|
)
|
|
227
|
-
|
|
228
|
-
|
|
210
|
+
|
|
211
|
+
if (
|
|
212
|
+
metric == "out_time_ms"
|
|
213
|
+
and progress_bar
|
|
214
|
+
and task_id is not None
|
|
215
|
+
):
|
|
216
|
+
progress_bar.update(
|
|
217
|
+
task_id,
|
|
218
|
+
completed=self._metrics.seconds_processed,
|
|
219
|
+
speed=self._metrics.speed,
|
|
220
|
+
)
|
|
221
|
+
except Empty:
|
|
222
|
+
pass
|
|
229
223
|
|
|
230
224
|
try:
|
|
231
225
|
stderr = stderr_queue.get_nowait()
|
|
226
|
+
|
|
227
|
+
if self._duration_secs is None:
|
|
228
|
+
print(stderr, end="\r")
|
|
229
|
+
|
|
232
230
|
self._ffmpeg_stderr.append(stderr)
|
|
233
231
|
except Empty:
|
|
234
232
|
pass
|
|
@@ -258,7 +256,9 @@ class FfmpegProcess:
|
|
|
258
256
|
if not self._check_output_exists():
|
|
259
257
|
return
|
|
260
258
|
|
|
261
|
-
print(
|
|
259
|
+
print(
|
|
260
|
+
f"Executing: {' '.join(self._ffmpeg_args)}{"\n" if self._duration_secs is None else ""}"
|
|
261
|
+
)
|
|
262
262
|
|
|
263
263
|
if self._duration_secs and not progress_handler:
|
|
264
264
|
with Progress(
|
|
@@ -314,7 +314,9 @@ class FfmpegProcess:
|
|
|
314
314
|
if success_handler:
|
|
315
315
|
success_handler()
|
|
316
316
|
else:
|
|
317
|
-
print(
|
|
317
|
+
print(
|
|
318
|
+
f"{"\n" if self._duration_secs is None else ""}FFmpeg process completed."
|
|
319
|
+
)
|
|
318
320
|
|
|
319
321
|
def _kill_process_and_children(self, proc_pid):
|
|
320
322
|
try:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: better-ffmpeg-progress
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: Run FFmpeg & see percentage progress + ETA.
|
|
5
5
|
Home-page: https://github.com/CrypticSignal/better-ffmpeg-progress
|
|
6
6
|
Author: GitHub.com/CrypticSignal
|
|
@@ -168,3 +168,6 @@ The `run` method takes the following **optional** arguments:
|
|
|
168
168
|
[29/10/2024]
|
|
169
169
|
- [v2.3.0] Set `shell=True` to support piping.
|
|
170
170
|
- [v2.3.1] Kill FFmpeg process(es) on KeyboardInterrupt
|
|
171
|
+
|
|
172
|
+
[31/10/2024]
|
|
173
|
+
- [v2.4.0] Print FFmpeg stderr if better progress information cannot be shown.
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as f:
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name="better-ffmpeg-progress",
|
|
8
|
-
version="2.
|
|
8
|
+
version="2.4.0",
|
|
9
9
|
author="GitHub.com/CrypticSignal",
|
|
10
10
|
author_email="theaudiophile@outlook.com",
|
|
11
11
|
description="Run FFmpeg & see percentage progress + ETA.",
|
|
File without changes
|
{better_ffmpeg_progress-2.3.1 → better_ffmpeg_progress-2.4.0}/better_ffmpeg_progress/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|