better-ffmpeg-progress 2.5.7__tar.gz → 2.6.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.5.7 → better_ffmpeg_progress-2.6.0}/PKG-INFO +3 -71
- {better_ffmpeg_progress-2.5.7 → better_ffmpeg_progress-2.6.0}/README.md +3 -71
- {better_ffmpeg_progress-2.5.7 → better_ffmpeg_progress-2.6.0}/better_ffmpeg_progress/better_ffmpeg_progress.py +44 -19
- better_ffmpeg_progress-2.6.0/better_ffmpeg_progress/utils.py +10 -0
- {better_ffmpeg_progress-2.5.7 → better_ffmpeg_progress-2.6.0}/better_ffmpeg_progress.egg-info/PKG-INFO +3 -71
- {better_ffmpeg_progress-2.5.7 → better_ffmpeg_progress-2.6.0}/better_ffmpeg_progress.egg-info/SOURCES.txt +1 -0
- {better_ffmpeg_progress-2.5.7 → better_ffmpeg_progress-2.6.0}/setup.py +1 -1
- {better_ffmpeg_progress-2.5.7 → better_ffmpeg_progress-2.6.0}/LICENSE +0 -0
- {better_ffmpeg_progress-2.5.7 → better_ffmpeg_progress-2.6.0}/better_ffmpeg_progress/__init__.py +0 -0
- {better_ffmpeg_progress-2.5.7 → better_ffmpeg_progress-2.6.0}/better_ffmpeg_progress.egg-info/dependency_links.txt +0 -0
- {better_ffmpeg_progress-2.5.7 → better_ffmpeg_progress-2.6.0}/better_ffmpeg_progress.egg-info/requires.txt +0 -0
- {better_ffmpeg_progress-2.5.7 → better_ffmpeg_progress-2.6.0}/better_ffmpeg_progress.egg-info/top_level.txt +0 -0
- {better_ffmpeg_progress-2.5.7 → better_ffmpeg_progress-2.6.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.6.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
|
|
@@ -91,11 +91,12 @@ process.run(
|
|
|
91
91
|
## Optional Arguments
|
|
92
92
|
An instance of the `FfmpegProcess` class takes the following **optional** arguments:
|
|
93
93
|
|
|
94
|
-
- `ffmpeg_loglevel`: Desired FFmpeg log level. Default: "verbose"
|
|
94
|
+
- `ffmpeg_loglevel`: Desired FFmpeg log level. Default: `"verbose"`
|
|
95
95
|
- `print_stderr_new_line`: If better progress information cannot be shown, print FFmpeg stderr in a new line instead of replacing the current line in the terminal. Default: False
|
|
96
96
|
- `print_detected_duration`: Print the detected duration of the input file. Default: True
|
|
97
97
|
|
|
98
98
|
The `run` method takes the following **optional** arguments:
|
|
99
|
+
- `print_command` - Print the FFmpeg command being executed. Default: `False`
|
|
99
100
|
- `progress_bar_description` - An optional string to set a custom description for the progress bar. The default description is `Processing <file>`. This can be an empty string if you don't want the progress bar to have a description.
|
|
100
101
|
- `progress_handler`
|
|
101
102
|
- You can create a function if you would like to do something with the following values:
|
|
@@ -110,72 +111,3 @@ The `run` method takes the following **optional** arguments:
|
|
|
110
111
|
- `log_file` - The filepath to save the FFmpeg log to.
|
|
111
112
|
- `success_handler` - A function to run if the FFmpeg process completes successfully.
|
|
112
113
|
- `error_handler` - A function to run if the FFmpeg process encounters an error.
|
|
113
|
-
|
|
114
|
-
## Changelog
|
|
115
|
-
[19/09/2022]
|
|
116
|
-
- Add the ability to specify a `success_handler` argument, a function to run if the FFmpeg process completes successfully.
|
|
117
|
-
- Add 0.001 to tqdm's `total` parameter to prevent the chance of getting `TqdmWarning: clamping frac to range [0, 1]`
|
|
118
|
-
|
|
119
|
-
[21/12/2022]
|
|
120
|
-
- [v2.0.7] Fix `'estimated_size' referenced before assignment` error.
|
|
121
|
-
- [v2.0.7] The progress bar now uses 1 decimal place for seconds processed and total duration.
|
|
122
|
-
|
|
123
|
-
[22/12/2022]
|
|
124
|
-
- [v2.0.8] Add the ability to specify an `error_handler` argument, a function to run if the FFmpeg process encounters an error.
|
|
125
|
-
- [v2.0.9] Fix a typo (commit [da45a84](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/da45a8416856ab7d3c7b748db5703fa3dbc65f60))
|
|
126
|
-
|
|
127
|
-
[07/02/2022]
|
|
128
|
-
- [v2.1.0] [Update function name](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/572fe8a0d71957d00b833134a4d35170630203fa) to fix `'process_complete_handler' is not defined` error.
|
|
129
|
-
|
|
130
|
-
[05/11/2023]
|
|
131
|
-
- [v2.1.2] [Do not exit the Python interpreter after the FFmpeg process is complete](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/0a358810773835297faae688689c6e0d8a5859ae)
|
|
132
|
-
|
|
133
|
-
[22/04/2024]
|
|
134
|
-
- [v2.1.3] Fix issue [#20](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/20)
|
|
135
|
-
|
|
136
|
-
[28/04/2024]
|
|
137
|
-
- [v2.1.4] Fix issue [#21](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/21)
|
|
138
|
-
|
|
139
|
-
[02/05/2024]
|
|
140
|
-
- [v2.1.5] Fix issue [#23](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/23) and make an error message more specific. [Here](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/a6ef7f26d080b684144021301f3b2aa5e0834dae) is the relevant commit.
|
|
141
|
-
|
|
142
|
-
[18/10/2024]
|
|
143
|
-
- [v2.1.6] Notify the user if the input filepath or filename is incorrect.
|
|
144
|
-
- [v2.1.7] Refactor to use threads and queues.
|
|
145
|
-
|
|
146
|
-
[19/10/2024]
|
|
147
|
-
- [v2.1.8] Use [Rich](https://github.com/Textualize/rich) instead of [tqdm](https://github.com/tqdm/tqdm) and format code with [Ruff](https://github.com/astral-sh/ruff).
|
|
148
|
-
|
|
149
|
-
[20/10/2024]
|
|
150
|
-
- [v2.1.9] Do not clear the terminal before showing the progress bar.
|
|
151
|
-
- [v2.2.0] Add the ability to set a custom description for the progress bar.
|
|
152
|
-
|
|
153
|
-
[22/10/2024]
|
|
154
|
-
- [v2.2.1] Only create a log file if the `log_file` parameter is specified and always create a log file if the FFmpeg process fails.
|
|
155
|
-
|
|
156
|
-
[28/10/2024]
|
|
157
|
-
- [v2.2.2] Make printing the detected duration of the input file optional.
|
|
158
|
-
|
|
159
|
-
[29/10/2024]
|
|
160
|
-
- [v2.3.0] Set `shell=True` to support piping.
|
|
161
|
-
- [v2.3.1] Kill FFmpeg process(es) on KeyboardInterrupt
|
|
162
|
-
|
|
163
|
-
[31/10/2024]
|
|
164
|
-
- [v2.4.0] Print FFmpeg stderr if better progress information cannot be shown.
|
|
165
|
-
- [v2.4.0] Flush the stream when printing FFmpeg stderr to ensure that it is printed immediately.
|
|
166
|
-
- [v2.5.0] Add an option to print FFmpeg stderr on a new line if better progress information cannot be shown.
|
|
167
|
-
|
|
168
|
-
[11/11/2024]
|
|
169
|
-
- [v2.5.1] Print the correct log file.
|
|
170
|
-
|
|
171
|
-
[12/11/2024]
|
|
172
|
-
- [v2.5.2] Drain any remaining FFmpeg stderr after the process ends.
|
|
173
|
-
- [v2.5.3] Write FFmpeg stderr to the log file in real time.
|
|
174
|
-
- [v2.5.4] Include progress info in stderr if the duration of the input file cannot be detected.
|
|
175
|
-
- [v2.5.5] Print detected errors in the terminal and only set `shell=True` if shell operators are detected.
|
|
176
|
-
|
|
177
|
-
[13/11/2024]
|
|
178
|
-
- [v2.5.6] Detect a wider range of errors.
|
|
179
|
-
|
|
180
|
-
[18/11/2024]
|
|
181
|
-
- [v2.5.7] Fix syntax. Should fix issue #26
|
|
@@ -73,11 +73,12 @@ process.run(
|
|
|
73
73
|
## Optional Arguments
|
|
74
74
|
An instance of the `FfmpegProcess` class takes the following **optional** arguments:
|
|
75
75
|
|
|
76
|
-
- `ffmpeg_loglevel`: Desired FFmpeg log level. Default: "verbose"
|
|
76
|
+
- `ffmpeg_loglevel`: Desired FFmpeg log level. Default: `"verbose"`
|
|
77
77
|
- `print_stderr_new_line`: If better progress information cannot be shown, print FFmpeg stderr in a new line instead of replacing the current line in the terminal. Default: False
|
|
78
78
|
- `print_detected_duration`: Print the detected duration of the input file. Default: True
|
|
79
79
|
|
|
80
80
|
The `run` method takes the following **optional** arguments:
|
|
81
|
+
- `print_command` - Print the FFmpeg command being executed. Default: `False`
|
|
81
82
|
- `progress_bar_description` - An optional string to set a custom description for the progress bar. The default description is `Processing <file>`. This can be an empty string if you don't want the progress bar to have a description.
|
|
82
83
|
- `progress_handler`
|
|
83
84
|
- You can create a function if you would like to do something with the following values:
|
|
@@ -91,73 +92,4 @@ The `run` method takes the following **optional** arguments:
|
|
|
91
92
|
|
|
92
93
|
- `log_file` - The filepath to save the FFmpeg log to.
|
|
93
94
|
- `success_handler` - A function to run if the FFmpeg process completes successfully.
|
|
94
|
-
- `error_handler` - A function to run if the FFmpeg process encounters an error.
|
|
95
|
-
|
|
96
|
-
## Changelog
|
|
97
|
-
[19/09/2022]
|
|
98
|
-
- Add the ability to specify a `success_handler` argument, a function to run if the FFmpeg process completes successfully.
|
|
99
|
-
- Add 0.001 to tqdm's `total` parameter to prevent the chance of getting `TqdmWarning: clamping frac to range [0, 1]`
|
|
100
|
-
|
|
101
|
-
[21/12/2022]
|
|
102
|
-
- [v2.0.7] Fix `'estimated_size' referenced before assignment` error.
|
|
103
|
-
- [v2.0.7] The progress bar now uses 1 decimal place for seconds processed and total duration.
|
|
104
|
-
|
|
105
|
-
[22/12/2022]
|
|
106
|
-
- [v2.0.8] Add the ability to specify an `error_handler` argument, a function to run if the FFmpeg process encounters an error.
|
|
107
|
-
- [v2.0.9] Fix a typo (commit [da45a84](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/da45a8416856ab7d3c7b748db5703fa3dbc65f60))
|
|
108
|
-
|
|
109
|
-
[07/02/2022]
|
|
110
|
-
- [v2.1.0] [Update function name](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/572fe8a0d71957d00b833134a4d35170630203fa) to fix `'process_complete_handler' is not defined` error.
|
|
111
|
-
|
|
112
|
-
[05/11/2023]
|
|
113
|
-
- [v2.1.2] [Do not exit the Python interpreter after the FFmpeg process is complete](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/0a358810773835297faae688689c6e0d8a5859ae)
|
|
114
|
-
|
|
115
|
-
[22/04/2024]
|
|
116
|
-
- [v2.1.3] Fix issue [#20](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/20)
|
|
117
|
-
|
|
118
|
-
[28/04/2024]
|
|
119
|
-
- [v2.1.4] Fix issue [#21](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/21)
|
|
120
|
-
|
|
121
|
-
[02/05/2024]
|
|
122
|
-
- [v2.1.5] Fix issue [#23](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/23) and make an error message more specific. [Here](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/a6ef7f26d080b684144021301f3b2aa5e0834dae) is the relevant commit.
|
|
123
|
-
|
|
124
|
-
[18/10/2024]
|
|
125
|
-
- [v2.1.6] Notify the user if the input filepath or filename is incorrect.
|
|
126
|
-
- [v2.1.7] Refactor to use threads and queues.
|
|
127
|
-
|
|
128
|
-
[19/10/2024]
|
|
129
|
-
- [v2.1.8] Use [Rich](https://github.com/Textualize/rich) instead of [tqdm](https://github.com/tqdm/tqdm) and format code with [Ruff](https://github.com/astral-sh/ruff).
|
|
130
|
-
|
|
131
|
-
[20/10/2024]
|
|
132
|
-
- [v2.1.9] Do not clear the terminal before showing the progress bar.
|
|
133
|
-
- [v2.2.0] Add the ability to set a custom description for the progress bar.
|
|
134
|
-
|
|
135
|
-
[22/10/2024]
|
|
136
|
-
- [v2.2.1] Only create a log file if the `log_file` parameter is specified and always create a log file if the FFmpeg process fails.
|
|
137
|
-
|
|
138
|
-
[28/10/2024]
|
|
139
|
-
- [v2.2.2] Make printing the detected duration of the input file optional.
|
|
140
|
-
|
|
141
|
-
[29/10/2024]
|
|
142
|
-
- [v2.3.0] Set `shell=True` to support piping.
|
|
143
|
-
- [v2.3.1] Kill FFmpeg process(es) on KeyboardInterrupt
|
|
144
|
-
|
|
145
|
-
[31/10/2024]
|
|
146
|
-
- [v2.4.0] Print FFmpeg stderr if better progress information cannot be shown.
|
|
147
|
-
- [v2.4.0] Flush the stream when printing FFmpeg stderr to ensure that it is printed immediately.
|
|
148
|
-
- [v2.5.0] Add an option to print FFmpeg stderr on a new line if better progress information cannot be shown.
|
|
149
|
-
|
|
150
|
-
[11/11/2024]
|
|
151
|
-
- [v2.5.1] Print the correct log file.
|
|
152
|
-
|
|
153
|
-
[12/11/2024]
|
|
154
|
-
- [v2.5.2] Drain any remaining FFmpeg stderr after the process ends.
|
|
155
|
-
- [v2.5.3] Write FFmpeg stderr to the log file in real time.
|
|
156
|
-
- [v2.5.4] Include progress info in stderr if the duration of the input file cannot be detected.
|
|
157
|
-
- [v2.5.5] Print detected errors in the terminal and only set `shell=True` if shell operators are detected.
|
|
158
|
-
|
|
159
|
-
[13/11/2024]
|
|
160
|
-
- [v2.5.6] Detect a wider range of errors.
|
|
161
|
-
|
|
162
|
-
[18/11/2024]
|
|
163
|
-
- [v2.5.7] Fix syntax. Should fix issue #26
|
|
95
|
+
- `error_handler` - A function to run if the FFmpeg process encounters an error.
|
|
@@ -7,6 +7,8 @@ import sys
|
|
|
7
7
|
from threading import Thread
|
|
8
8
|
from typing import Callable, List, Optional, Union
|
|
9
9
|
|
|
10
|
+
from .utils import line, print_with_prefix
|
|
11
|
+
|
|
10
12
|
from ffmpeg import probe
|
|
11
13
|
import psutil
|
|
12
14
|
from rich.progress import (
|
|
@@ -60,6 +62,7 @@ class FfmpegProcess:
|
|
|
60
62
|
# -stats_period sets the period at which encoding progress/statistics are updated
|
|
61
63
|
command.extend(
|
|
62
64
|
[
|
|
65
|
+
"-hide_banner",
|
|
63
66
|
"-loglevel",
|
|
64
67
|
ffmpeg_loglevel,
|
|
65
68
|
"-progress",
|
|
@@ -74,11 +77,10 @@ class FfmpegProcess:
|
|
|
74
77
|
self._print_detected_duration = print_detected_duration
|
|
75
78
|
self._print_stderr_new_line = print_stderr_new_line
|
|
76
79
|
self._metrics = Metrics()
|
|
77
|
-
self._duration_secs: Optional[float]
|
|
80
|
+
self._duration_secs: Optional[float]
|
|
78
81
|
self._current_size: int = 0
|
|
79
82
|
self._ffmpeg_log_file: Optional[Path] = None
|
|
80
83
|
self._error_messages: list[str] = []
|
|
81
|
-
|
|
82
84
|
self._get_input_file_duration()
|
|
83
85
|
|
|
84
86
|
def _get_input_file_duration(self) -> None:
|
|
@@ -92,16 +94,20 @@ class FfmpegProcess:
|
|
|
92
94
|
)
|
|
93
95
|
|
|
94
96
|
if self._print_detected_duration:
|
|
97
|
+
line()
|
|
95
98
|
print(
|
|
96
99
|
f"The duration of {self._input_filepath.name} has been detected as {self._duration_secs} seconds"
|
|
97
100
|
)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
line()
|
|
102
|
+
|
|
103
|
+
# -nostats ensures that progress information is not sent to stderr as this info is not needed in the log file, e.g.
|
|
104
|
+
# frame= 1381 fps=254 q=18.0 size= 46592KiB time=00:00:46.07 bitrate=8283.1kbits/s speed=8.47x
|
|
105
|
+
self._ffmpeg_command.extend(["-nostats"])
|
|
101
106
|
except Exception:
|
|
102
107
|
print(
|
|
103
108
|
f"Could not detect the duration of '{self._input_filepath.name}'. Percentage progress, ETA and estimated filesize will be unavailable.\n",
|
|
104
109
|
)
|
|
110
|
+
self._duration_secs = None
|
|
105
111
|
|
|
106
112
|
def _check_output_exists(self) -> bool:
|
|
107
113
|
"""Check if output file exists and handle overwrite prompt."""
|
|
@@ -235,6 +241,7 @@ class FfmpegProcess:
|
|
|
235
241
|
if self._duration_secs is not None:
|
|
236
242
|
try:
|
|
237
243
|
stdout = stdout_queue.get_nowait()
|
|
244
|
+
|
|
238
245
|
if stdout:
|
|
239
246
|
metric, value = stdout.split("=")
|
|
240
247
|
if (
|
|
@@ -260,6 +267,7 @@ class FfmpegProcess:
|
|
|
260
267
|
|
|
261
268
|
try:
|
|
262
269
|
stderr = stderr_queue.get_nowait()
|
|
270
|
+
|
|
263
271
|
if stderr:
|
|
264
272
|
self._write_to_log_file(stderr)
|
|
265
273
|
|
|
@@ -277,10 +285,8 @@ class FfmpegProcess:
|
|
|
277
285
|
|
|
278
286
|
except KeyboardInterrupt:
|
|
279
287
|
self._kill_process_and_children(process.pid)
|
|
280
|
-
self._write_to_log_file("\n[KeyboardInterrupt] FFmpeg process
|
|
281
|
-
sys.exit(
|
|
282
|
-
f"{'\n' if self._duration_secs is None else ''}[KeyboardInterrupt] FFmpeg process(es) killed."
|
|
283
|
-
)
|
|
288
|
+
self._write_to_log_file("\n[KeyboardInterrupt] FFmpeg process killed.")
|
|
289
|
+
sys.exit("\n[KeyboardInterrupt] FFmpeg process killed.")
|
|
284
290
|
|
|
285
291
|
# After the process ends, drain any remaining stderr
|
|
286
292
|
while True:
|
|
@@ -306,6 +312,7 @@ class FfmpegProcess:
|
|
|
306
312
|
def run(
|
|
307
313
|
self,
|
|
308
314
|
log_file: Optional[Union[str, Path]] = "ffmpeg_log.txt",
|
|
315
|
+
print_command=False,
|
|
309
316
|
progress_bar_description: str = None,
|
|
310
317
|
progress_handler: Optional[Callable] = None,
|
|
311
318
|
success_handler: Optional[Callable] = None,
|
|
@@ -314,6 +321,7 @@ class FfmpegProcess:
|
|
|
314
321
|
"""
|
|
315
322
|
Args:
|
|
316
323
|
log_file: Optional filepath to write FFmpeg output to
|
|
324
|
+
print_command: Print the FFmpeg command being executed. Default: False
|
|
317
325
|
progress_bar_description: Optional string to set a custom description for the progress bar
|
|
318
326
|
progress_handler: Optional function which receives progress metrics
|
|
319
327
|
success_handler: Optional function to handle successful completion of the FFmpeg process
|
|
@@ -327,9 +335,10 @@ class FfmpegProcess:
|
|
|
327
335
|
with open(self._ffmpeg_log_file, "w"):
|
|
328
336
|
pass
|
|
329
337
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
338
|
+
if print_command:
|
|
339
|
+
line()
|
|
340
|
+
|
|
341
|
+
print(f"Executing: {' '.join(self._ffmpeg_command)}")
|
|
333
342
|
|
|
334
343
|
if self._duration_secs and not progress_handler:
|
|
335
344
|
with Progress(
|
|
@@ -353,6 +362,16 @@ class FfmpegProcess:
|
|
|
353
362
|
task_id,
|
|
354
363
|
None,
|
|
355
364
|
)
|
|
365
|
+
|
|
366
|
+
if return_code == 0:
|
|
367
|
+
progress_bar.columns = (
|
|
368
|
+
TextColumn("[progress.description]{task.description}"),
|
|
369
|
+
)
|
|
370
|
+
progress_bar.update(
|
|
371
|
+
task_id,
|
|
372
|
+
description=f"✓ Processed 100% of {self._input_filepath.name}",
|
|
373
|
+
)
|
|
374
|
+
|
|
356
375
|
else:
|
|
357
376
|
return_code = self._start_process(
|
|
358
377
|
None,
|
|
@@ -360,6 +379,12 @@ class FfmpegProcess:
|
|
|
360
379
|
progress_handler,
|
|
361
380
|
)
|
|
362
381
|
|
|
382
|
+
if return_code == 0:
|
|
383
|
+
print_with_prefix(
|
|
384
|
+
"FFmpeg process completed.",
|
|
385
|
+
"\n" if self._duration_secs is None else "",
|
|
386
|
+
)
|
|
387
|
+
|
|
363
388
|
self._handle_process_ended(return_code, error_handler, success_handler)
|
|
364
389
|
|
|
365
390
|
def _handle_process_ended(
|
|
@@ -372,17 +397,17 @@ class FfmpegProcess:
|
|
|
372
397
|
if return_code != 0:
|
|
373
398
|
if error_handler:
|
|
374
399
|
error_handler()
|
|
400
|
+
sys.exit(
|
|
401
|
+
"\nThe FFmpeg process encounted an error. Custom error handler executed."
|
|
402
|
+
)
|
|
375
403
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
)
|
|
404
|
+
print(f"FFmpeg process failed with return code {return_code}.\nError(s):")
|
|
405
|
+
print("\n".join(self._error_messages))
|
|
406
|
+
print(f"Check out '{self._ffmpeg_log_file}' for more details.")
|
|
407
|
+
sys.exit(1)
|
|
379
408
|
|
|
380
409
|
if success_handler:
|
|
381
410
|
success_handler()
|
|
382
|
-
else:
|
|
383
|
-
print(
|
|
384
|
-
f"{'\n' if self._duration_secs is None else ''}FFmpeg process completed."
|
|
385
|
-
)
|
|
386
411
|
|
|
387
412
|
def _kill_process_and_children(self, proc_pid: int) -> None:
|
|
388
413
|
"""Kill the FFmpeg process and its children."""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: better-ffmpeg-progress
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.6.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
|
|
@@ -91,11 +91,12 @@ process.run(
|
|
|
91
91
|
## Optional Arguments
|
|
92
92
|
An instance of the `FfmpegProcess` class takes the following **optional** arguments:
|
|
93
93
|
|
|
94
|
-
- `ffmpeg_loglevel`: Desired FFmpeg log level. Default: "verbose"
|
|
94
|
+
- `ffmpeg_loglevel`: Desired FFmpeg log level. Default: `"verbose"`
|
|
95
95
|
- `print_stderr_new_line`: If better progress information cannot be shown, print FFmpeg stderr in a new line instead of replacing the current line in the terminal. Default: False
|
|
96
96
|
- `print_detected_duration`: Print the detected duration of the input file. Default: True
|
|
97
97
|
|
|
98
98
|
The `run` method takes the following **optional** arguments:
|
|
99
|
+
- `print_command` - Print the FFmpeg command being executed. Default: `False`
|
|
99
100
|
- `progress_bar_description` - An optional string to set a custom description for the progress bar. The default description is `Processing <file>`. This can be an empty string if you don't want the progress bar to have a description.
|
|
100
101
|
- `progress_handler`
|
|
101
102
|
- You can create a function if you would like to do something with the following values:
|
|
@@ -110,72 +111,3 @@ The `run` method takes the following **optional** arguments:
|
|
|
110
111
|
- `log_file` - The filepath to save the FFmpeg log to.
|
|
111
112
|
- `success_handler` - A function to run if the FFmpeg process completes successfully.
|
|
112
113
|
- `error_handler` - A function to run if the FFmpeg process encounters an error.
|
|
113
|
-
|
|
114
|
-
## Changelog
|
|
115
|
-
[19/09/2022]
|
|
116
|
-
- Add the ability to specify a `success_handler` argument, a function to run if the FFmpeg process completes successfully.
|
|
117
|
-
- Add 0.001 to tqdm's `total` parameter to prevent the chance of getting `TqdmWarning: clamping frac to range [0, 1]`
|
|
118
|
-
|
|
119
|
-
[21/12/2022]
|
|
120
|
-
- [v2.0.7] Fix `'estimated_size' referenced before assignment` error.
|
|
121
|
-
- [v2.0.7] The progress bar now uses 1 decimal place for seconds processed and total duration.
|
|
122
|
-
|
|
123
|
-
[22/12/2022]
|
|
124
|
-
- [v2.0.8] Add the ability to specify an `error_handler` argument, a function to run if the FFmpeg process encounters an error.
|
|
125
|
-
- [v2.0.9] Fix a typo (commit [da45a84](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/da45a8416856ab7d3c7b748db5703fa3dbc65f60))
|
|
126
|
-
|
|
127
|
-
[07/02/2022]
|
|
128
|
-
- [v2.1.0] [Update function name](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/572fe8a0d71957d00b833134a4d35170630203fa) to fix `'process_complete_handler' is not defined` error.
|
|
129
|
-
|
|
130
|
-
[05/11/2023]
|
|
131
|
-
- [v2.1.2] [Do not exit the Python interpreter after the FFmpeg process is complete](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/0a358810773835297faae688689c6e0d8a5859ae)
|
|
132
|
-
|
|
133
|
-
[22/04/2024]
|
|
134
|
-
- [v2.1.3] Fix issue [#20](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/20)
|
|
135
|
-
|
|
136
|
-
[28/04/2024]
|
|
137
|
-
- [v2.1.4] Fix issue [#21](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/21)
|
|
138
|
-
|
|
139
|
-
[02/05/2024]
|
|
140
|
-
- [v2.1.5] Fix issue [#23](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/23) and make an error message more specific. [Here](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/a6ef7f26d080b684144021301f3b2aa5e0834dae) is the relevant commit.
|
|
141
|
-
|
|
142
|
-
[18/10/2024]
|
|
143
|
-
- [v2.1.6] Notify the user if the input filepath or filename is incorrect.
|
|
144
|
-
- [v2.1.7] Refactor to use threads and queues.
|
|
145
|
-
|
|
146
|
-
[19/10/2024]
|
|
147
|
-
- [v2.1.8] Use [Rich](https://github.com/Textualize/rich) instead of [tqdm](https://github.com/tqdm/tqdm) and format code with [Ruff](https://github.com/astral-sh/ruff).
|
|
148
|
-
|
|
149
|
-
[20/10/2024]
|
|
150
|
-
- [v2.1.9] Do not clear the terminal before showing the progress bar.
|
|
151
|
-
- [v2.2.0] Add the ability to set a custom description for the progress bar.
|
|
152
|
-
|
|
153
|
-
[22/10/2024]
|
|
154
|
-
- [v2.2.1] Only create a log file if the `log_file` parameter is specified and always create a log file if the FFmpeg process fails.
|
|
155
|
-
|
|
156
|
-
[28/10/2024]
|
|
157
|
-
- [v2.2.2] Make printing the detected duration of the input file optional.
|
|
158
|
-
|
|
159
|
-
[29/10/2024]
|
|
160
|
-
- [v2.3.0] Set `shell=True` to support piping.
|
|
161
|
-
- [v2.3.1] Kill FFmpeg process(es) on KeyboardInterrupt
|
|
162
|
-
|
|
163
|
-
[31/10/2024]
|
|
164
|
-
- [v2.4.0] Print FFmpeg stderr if better progress information cannot be shown.
|
|
165
|
-
- [v2.4.0] Flush the stream when printing FFmpeg stderr to ensure that it is printed immediately.
|
|
166
|
-
- [v2.5.0] Add an option to print FFmpeg stderr on a new line if better progress information cannot be shown.
|
|
167
|
-
|
|
168
|
-
[11/11/2024]
|
|
169
|
-
- [v2.5.1] Print the correct log file.
|
|
170
|
-
|
|
171
|
-
[12/11/2024]
|
|
172
|
-
- [v2.5.2] Drain any remaining FFmpeg stderr after the process ends.
|
|
173
|
-
- [v2.5.3] Write FFmpeg stderr to the log file in real time.
|
|
174
|
-
- [v2.5.4] Include progress info in stderr if the duration of the input file cannot be detected.
|
|
175
|
-
- [v2.5.5] Print detected errors in the terminal and only set `shell=True` if shell operators are detected.
|
|
176
|
-
|
|
177
|
-
[13/11/2024]
|
|
178
|
-
- [v2.5.6] Detect a wider range of errors.
|
|
179
|
-
|
|
180
|
-
[18/11/2024]
|
|
181
|
-
- [v2.5.7] Fix syntax. Should fix issue #26
|
|
@@ -3,6 +3,7 @@ README.md
|
|
|
3
3
|
setup.py
|
|
4
4
|
better_ffmpeg_progress/__init__.py
|
|
5
5
|
better_ffmpeg_progress/better_ffmpeg_progress.py
|
|
6
|
+
better_ffmpeg_progress/utils.py
|
|
6
7
|
better_ffmpeg_progress.egg-info/PKG-INFO
|
|
7
8
|
better_ffmpeg_progress.egg-info/SOURCES.txt
|
|
8
9
|
better_ffmpeg_progress.egg-info/dependency_links.txt
|
|
@@ -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.6.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.5.7 → better_ffmpeg_progress-2.6.0}/better_ffmpeg_progress/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|