better-ffmpeg-progress 2.4.1__tar.gz → 2.5.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.4.1 → better_ffmpeg_progress-2.5.0}/PKG-INFO +20 -29
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.0}/README.md +20 -29
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.0}/better_ffmpeg_progress/better_ffmpeg_progress.py +10 -2
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.0}/better_ffmpeg_progress.egg-info/PKG-INFO +20 -29
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.0}/setup.py +1 -1
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.0}/LICENSE +0 -0
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.0}/better_ffmpeg_progress/__init__.py +0 -0
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.0}/better_ffmpeg_progress.egg-info/SOURCES.txt +0 -0
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.0}/better_ffmpeg_progress.egg-info/dependency_links.txt +0 -0
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.0}/better_ffmpeg_progress.egg-info/requires.txt +0 -0
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.0}/better_ffmpeg_progress.egg-info/top_level.txt +0 -0
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.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.5.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
|
|
@@ -23,35 +23,34 @@ Requires-Dist: rich
|
|
|
23
23
|
[](LICENSE.txt)
|
|
24
24
|
|
|
25
25
|
# Better FFmpeg Progress
|
|
26
|
-
|
|
27
|
-
Runs an FFmpeg command and uses [Rich](https://github.com/Textualize/rich) to show a progress bar.
|
|
28
|
-
|
|
26
|
+
Runs an FFmpeg command and shows a progress bar with percentage progress, time elapsed and ETA.
|
|
29
27
|
</div>
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
FFmpeg outputs something like:
|
|
30
|
+
```
|
|
31
|
+
frame= 692 fps= 58 q=28.0 size= 5376KiB time=00:00:28.77 bitrate=1530.3kbits/s speed=2.43x
|
|
32
|
+
```
|
|
33
|
+
Better FFmpeg Process outputs something like:
|
|
33
34
|
```
|
|
34
35
|
⠏ Processing abc.webm ━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23% 0:00:04 00:15
|
|
35
36
|
```
|
|
36
|
-
|
|
37
37
|
Where:
|
|
38
38
|
- `Processing abc.webm` is the description of the progresss bar.
|
|
39
39
|
- `23%` is the percentage progress.
|
|
40
40
|
- `0:00:04` is the time (H:MM:SS) elapsed.
|
|
41
41
|
- `00:15` is the estimated time until the FFmpeg process completes.
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
As you can see, the output of Better FFmpeg Progress is much more useful.
|
|
44
44
|
|
|
45
|
+
## Installation
|
|
45
46
|
```
|
|
46
47
|
pip install better-ffmpeg-progress --upgrade
|
|
47
48
|
```
|
|
48
49
|
|
|
49
|
-
## Usage
|
|
50
|
-
|
|
50
|
+
## Usage
|
|
51
51
|
Create an instance of the `FfmpegProcess` class and supply a list of arguments like you would to `subprocess.run()`.
|
|
52
52
|
|
|
53
53
|
Simple Example:
|
|
54
|
-
|
|
55
54
|
```py
|
|
56
55
|
from better_ffmpeg_progress import FfmpegProcess
|
|
57
56
|
# Pass a list of FFmpeg arguments, like you would if using subprocess.run()
|
|
@@ -61,7 +60,6 @@ process.run()
|
|
|
61
60
|
```
|
|
62
61
|
|
|
63
62
|
Advanced Example:
|
|
64
|
-
|
|
65
63
|
```py
|
|
66
64
|
from better_ffmpeg_progress import FfmpegProcess
|
|
67
65
|
|
|
@@ -76,7 +74,7 @@ def handle_error():
|
|
|
76
74
|
# Code to run if the FFmpeg process encounters an error.
|
|
77
75
|
pass
|
|
78
76
|
|
|
79
|
-
# Pass a list of FFmpeg arguments, like you would if using subprocess.run()
|
|
77
|
+
# Pass a list of FFmpeg arguments, like you would if using subprocess.run() or subprocess.Popen()
|
|
80
78
|
process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "output.mp3"])
|
|
81
79
|
|
|
82
80
|
# Use the run method to run the FFmpeg command.
|
|
@@ -89,13 +87,17 @@ process.run(
|
|
|
89
87
|
)
|
|
90
88
|
```
|
|
91
89
|
|
|
90
|
+
## Optional Arguments
|
|
91
|
+
An instance of the `FfmpegProcess` class takes the following **optional** arguments:
|
|
92
|
+
|
|
93
|
+
- `ffmpeg_loglevel`: Desired FFmpeg log level. Default: "verbose"
|
|
94
|
+
- `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
|
|
95
|
+
- `print_detected_duration`: Print the detected duration of the input file. Default: True
|
|
96
|
+
|
|
92
97
|
The `run` method takes the following **optional** arguments:
|
|
93
98
|
- `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.
|
|
94
|
-
|
|
95
99
|
- `progress_handler`
|
|
96
|
-
|
|
97
100
|
- You can create a function if you would like to do something with the following values:
|
|
98
|
-
|
|
99
101
|
- Percentage progress. [float]
|
|
100
102
|
- Speed, e.g. `22.3x` which means that 22.3 seconds of the input are processed every second. [string]
|
|
101
103
|
- ETA in seconds. [float]
|
|
@@ -105,50 +107,38 @@ The `run` method takes the following **optional** arguments:
|
|
|
105
107
|
The values will be `None` if unknown. The function will receive the current values of these metrics as arguments, every 0.1s.
|
|
106
108
|
|
|
107
109
|
- `log_file` - The filepath to save the FFmpeg log to.
|
|
108
|
-
|
|
109
110
|
- `success_handler` - A function to run if the FFmpeg process completes successfully.
|
|
110
|
-
|
|
111
111
|
- `error_handler` - A function to run if the FFmpeg process encounters an error.
|
|
112
112
|
|
|
113
|
-
## Changelog
|
|
114
|
-
|
|
113
|
+
## Changelog
|
|
115
114
|
[19/09/2022]
|
|
116
|
-
|
|
117
115
|
- Add the ability to specify a `success_handler` argument, a function to run if the FFmpeg process completes successfully.
|
|
118
116
|
- Add 0.001 to tqdm's `total` parameter to prevent the chance of getting `TqdmWarning: clamping frac to range [0, 1]`
|
|
119
117
|
|
|
120
118
|
[21/12/2022]
|
|
121
|
-
|
|
122
119
|
- [v2.0.7] Fix `'estimated_size' referenced before assignment` error.
|
|
123
120
|
- [v2.0.7] The progress bar now uses 1 decimal place for seconds processed and total duration.
|
|
124
121
|
|
|
125
122
|
[22/12/2022]
|
|
126
|
-
|
|
127
123
|
- [v2.0.8] Add the ability to specify an `error_handler` argument, a function to run if the FFmpeg process encounters an error.
|
|
128
124
|
- [v2.0.9] Fix a typo (commit [da45a84](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/da45a8416856ab7d3c7b748db5703fa3dbc65f60))
|
|
129
125
|
|
|
130
126
|
[07/02/2022]
|
|
131
|
-
|
|
132
127
|
- [v2.1.0] [Update function name](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/572fe8a0d71957d00b833134a4d35170630203fa) to fix `'process_complete_handler' is not defined` error.
|
|
133
128
|
|
|
134
129
|
[05/11/2023]
|
|
135
|
-
|
|
136
130
|
- [v2.1.2] [Do not exit the Python interpreter after the FFmpeg process is complete](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/0a358810773835297faae688689c6e0d8a5859ae)
|
|
137
131
|
|
|
138
132
|
[22/04/2024]
|
|
139
|
-
|
|
140
133
|
- [v2.1.3] Fix issue [#20](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/20)
|
|
141
134
|
|
|
142
135
|
[28/04/2024]
|
|
143
|
-
|
|
144
136
|
- [v2.1.4] Fix issue [#21](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/21)
|
|
145
137
|
|
|
146
138
|
[02/05/2024]
|
|
147
|
-
|
|
148
139
|
- [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.
|
|
149
140
|
|
|
150
141
|
[18/10/2024]
|
|
151
|
-
|
|
152
142
|
- [v2.1.6] Notify the user if the input filepath or filename is incorrect.
|
|
153
143
|
- [v2.1.7] Refactor to use threads and queues.
|
|
154
144
|
|
|
@@ -172,3 +162,4 @@ The `run` method takes the following **optional** arguments:
|
|
|
172
162
|
[31/10/2024]
|
|
173
163
|
- [v2.4.0] Print FFmpeg stderr if better progress information cannot be shown.
|
|
174
164
|
- [v2.4.0] Flush the stream when printing FFmpeg stderr to ensure that it is printed immediately.
|
|
165
|
+
- [v2.5.0] Add an option to print FFmpeg stderr on a new line if better progress information cannot be shown.
|
|
@@ -5,35 +5,34 @@
|
|
|
5
5
|
[](LICENSE.txt)
|
|
6
6
|
|
|
7
7
|
# Better FFmpeg Progress
|
|
8
|
-
|
|
9
|
-
Runs an FFmpeg command and uses [Rich](https://github.com/Textualize/rich) to show a progress bar.
|
|
10
|
-
|
|
8
|
+
Runs an FFmpeg command and shows a progress bar with percentage progress, time elapsed and ETA.
|
|
11
9
|
</div>
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
FFmpeg outputs something like:
|
|
12
|
+
```
|
|
13
|
+
frame= 692 fps= 58 q=28.0 size= 5376KiB time=00:00:28.77 bitrate=1530.3kbits/s speed=2.43x
|
|
14
|
+
```
|
|
15
|
+
Better FFmpeg Process outputs something like:
|
|
15
16
|
```
|
|
16
17
|
⠏ Processing abc.webm ━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23% 0:00:04 00:15
|
|
17
18
|
```
|
|
18
|
-
|
|
19
19
|
Where:
|
|
20
20
|
- `Processing abc.webm` is the description of the progresss bar.
|
|
21
21
|
- `23%` is the percentage progress.
|
|
22
22
|
- `0:00:04` is the time (H:MM:SS) elapsed.
|
|
23
23
|
- `00:15` is the estimated time until the FFmpeg process completes.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
As you can see, the output of Better FFmpeg Progress is much more useful.
|
|
26
26
|
|
|
27
|
+
## Installation
|
|
27
28
|
```
|
|
28
29
|
pip install better-ffmpeg-progress --upgrade
|
|
29
30
|
```
|
|
30
31
|
|
|
31
|
-
## Usage
|
|
32
|
-
|
|
32
|
+
## Usage
|
|
33
33
|
Create an instance of the `FfmpegProcess` class and supply a list of arguments like you would to `subprocess.run()`.
|
|
34
34
|
|
|
35
35
|
Simple Example:
|
|
36
|
-
|
|
37
36
|
```py
|
|
38
37
|
from better_ffmpeg_progress import FfmpegProcess
|
|
39
38
|
# Pass a list of FFmpeg arguments, like you would if using subprocess.run()
|
|
@@ -43,7 +42,6 @@ process.run()
|
|
|
43
42
|
```
|
|
44
43
|
|
|
45
44
|
Advanced Example:
|
|
46
|
-
|
|
47
45
|
```py
|
|
48
46
|
from better_ffmpeg_progress import FfmpegProcess
|
|
49
47
|
|
|
@@ -58,7 +56,7 @@ def handle_error():
|
|
|
58
56
|
# Code to run if the FFmpeg process encounters an error.
|
|
59
57
|
pass
|
|
60
58
|
|
|
61
|
-
# Pass a list of FFmpeg arguments, like you would if using subprocess.run()
|
|
59
|
+
# Pass a list of FFmpeg arguments, like you would if using subprocess.run() or subprocess.Popen()
|
|
62
60
|
process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "output.mp3"])
|
|
63
61
|
|
|
64
62
|
# Use the run method to run the FFmpeg command.
|
|
@@ -71,13 +69,17 @@ process.run(
|
|
|
71
69
|
)
|
|
72
70
|
```
|
|
73
71
|
|
|
72
|
+
## Optional Arguments
|
|
73
|
+
An instance of the `FfmpegProcess` class takes the following **optional** arguments:
|
|
74
|
+
|
|
75
|
+
- `ffmpeg_loglevel`: Desired FFmpeg log level. Default: "verbose"
|
|
76
|
+
- `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
|
|
77
|
+
- `print_detected_duration`: Print the detected duration of the input file. Default: True
|
|
78
|
+
|
|
74
79
|
The `run` method takes the following **optional** arguments:
|
|
75
80
|
- `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.
|
|
76
|
-
|
|
77
81
|
- `progress_handler`
|
|
78
|
-
|
|
79
82
|
- You can create a function if you would like to do something with the following values:
|
|
80
|
-
|
|
81
83
|
- Percentage progress. [float]
|
|
82
84
|
- Speed, e.g. `22.3x` which means that 22.3 seconds of the input are processed every second. [string]
|
|
83
85
|
- ETA in seconds. [float]
|
|
@@ -87,50 +89,38 @@ The `run` method takes the following **optional** arguments:
|
|
|
87
89
|
The values will be `None` if unknown. The function will receive the current values of these metrics as arguments, every 0.1s.
|
|
88
90
|
|
|
89
91
|
- `log_file` - The filepath to save the FFmpeg log to.
|
|
90
|
-
|
|
91
92
|
- `success_handler` - A function to run if the FFmpeg process completes successfully.
|
|
92
|
-
|
|
93
93
|
- `error_handler` - A function to run if the FFmpeg process encounters an error.
|
|
94
94
|
|
|
95
|
-
## Changelog
|
|
96
|
-
|
|
95
|
+
## Changelog
|
|
97
96
|
[19/09/2022]
|
|
98
|
-
|
|
99
97
|
- Add the ability to specify a `success_handler` argument, a function to run if the FFmpeg process completes successfully.
|
|
100
98
|
- Add 0.001 to tqdm's `total` parameter to prevent the chance of getting `TqdmWarning: clamping frac to range [0, 1]`
|
|
101
99
|
|
|
102
100
|
[21/12/2022]
|
|
103
|
-
|
|
104
101
|
- [v2.0.7] Fix `'estimated_size' referenced before assignment` error.
|
|
105
102
|
- [v2.0.7] The progress bar now uses 1 decimal place for seconds processed and total duration.
|
|
106
103
|
|
|
107
104
|
[22/12/2022]
|
|
108
|
-
|
|
109
105
|
- [v2.0.8] Add the ability to specify an `error_handler` argument, a function to run if the FFmpeg process encounters an error.
|
|
110
106
|
- [v2.0.9] Fix a typo (commit [da45a84](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/da45a8416856ab7d3c7b748db5703fa3dbc65f60))
|
|
111
107
|
|
|
112
108
|
[07/02/2022]
|
|
113
|
-
|
|
114
109
|
- [v2.1.0] [Update function name](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/572fe8a0d71957d00b833134a4d35170630203fa) to fix `'process_complete_handler' is not defined` error.
|
|
115
110
|
|
|
116
111
|
[05/11/2023]
|
|
117
|
-
|
|
118
112
|
- [v2.1.2] [Do not exit the Python interpreter after the FFmpeg process is complete](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/0a358810773835297faae688689c6e0d8a5859ae)
|
|
119
113
|
|
|
120
114
|
[22/04/2024]
|
|
121
|
-
|
|
122
115
|
- [v2.1.3] Fix issue [#20](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/20)
|
|
123
116
|
|
|
124
117
|
[28/04/2024]
|
|
125
|
-
|
|
126
118
|
- [v2.1.4] Fix issue [#21](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/21)
|
|
127
119
|
|
|
128
120
|
[02/05/2024]
|
|
129
|
-
|
|
130
121
|
- [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.
|
|
131
122
|
|
|
132
123
|
[18/10/2024]
|
|
133
|
-
|
|
134
124
|
- [v2.1.6] Notify the user if the input filepath or filename is incorrect.
|
|
135
125
|
- [v2.1.7] Refactor to use threads and queues.
|
|
136
126
|
|
|
@@ -153,4 +143,5 @@ The `run` method takes the following **optional** arguments:
|
|
|
153
143
|
|
|
154
144
|
[31/10/2024]
|
|
155
145
|
- [v2.4.0] Print FFmpeg stderr if better progress information cannot be shown.
|
|
156
|
-
- [v2.4.0] Flush the stream when printing FFmpeg stderr to ensure that it is printed immediately.
|
|
146
|
+
- [v2.4.0] Flush the stream when printing FFmpeg stderr to ensure that it is printed immediately.
|
|
147
|
+
- [v2.5.0] Add an option to print FFmpeg stderr on a new line if better progress information cannot be shown.
|
|
@@ -35,7 +35,9 @@ class FfmpegProcess:
|
|
|
35
35
|
"""
|
|
36
36
|
Args:
|
|
37
37
|
command: A list of arguments to pass to FFmpeg.
|
|
38
|
-
ffmpeg_loglevel: Desired FFmpeg log level. Default
|
|
38
|
+
ffmpeg_loglevel: Desired FFmpeg log level. Default: "verbose"
|
|
39
|
+
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
|
|
40
|
+
print_detected_duration: Print the detected duration of the input file. Default: True
|
|
39
41
|
|
|
40
42
|
Raises:
|
|
41
43
|
FileNotFoundError: If FFmpeg cannot find the input filepath or filename.
|
|
@@ -49,6 +51,7 @@ class FfmpegProcess:
|
|
|
49
51
|
command: List[str],
|
|
50
52
|
ffmpeg_loglevel: str = "verbose",
|
|
51
53
|
print_detected_duration: bool = True,
|
|
54
|
+
print_stderr_new_line: bool = False,
|
|
52
55
|
):
|
|
53
56
|
if "-i" not in command:
|
|
54
57
|
raise ValueError("FFmpeg command must include '-i'")
|
|
@@ -57,6 +60,7 @@ class FfmpegProcess:
|
|
|
57
60
|
self._ffmpeg_stderr: List[str] = []
|
|
58
61
|
self._output_filepath = Path(command[-1])
|
|
59
62
|
self._print_detected_duration = print_detected_duration
|
|
63
|
+
self._print_stderr_new_line = print_stderr_new_line
|
|
60
64
|
self._metrics = Metrics()
|
|
61
65
|
self._duration_secs: Optional[float] = None
|
|
62
66
|
self._current_size: int = 0
|
|
@@ -225,7 +229,11 @@ class FfmpegProcess:
|
|
|
225
229
|
stderr = stderr_queue.get_nowait()
|
|
226
230
|
|
|
227
231
|
if self._duration_secs is None:
|
|
228
|
-
print(
|
|
232
|
+
print(
|
|
233
|
+
stderr,
|
|
234
|
+
end="\n" if self._print_stderr_new_line else "\r",
|
|
235
|
+
flush=True,
|
|
236
|
+
)
|
|
229
237
|
|
|
230
238
|
self._ffmpeg_stderr.append(stderr)
|
|
231
239
|
except Empty:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: better-ffmpeg-progress
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.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
|
|
@@ -23,35 +23,34 @@ Requires-Dist: rich
|
|
|
23
23
|
[](LICENSE.txt)
|
|
24
24
|
|
|
25
25
|
# Better FFmpeg Progress
|
|
26
|
-
|
|
27
|
-
Runs an FFmpeg command and uses [Rich](https://github.com/Textualize/rich) to show a progress bar.
|
|
28
|
-
|
|
26
|
+
Runs an FFmpeg command and shows a progress bar with percentage progress, time elapsed and ETA.
|
|
29
27
|
</div>
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
FFmpeg outputs something like:
|
|
30
|
+
```
|
|
31
|
+
frame= 692 fps= 58 q=28.0 size= 5376KiB time=00:00:28.77 bitrate=1530.3kbits/s speed=2.43x
|
|
32
|
+
```
|
|
33
|
+
Better FFmpeg Process outputs something like:
|
|
33
34
|
```
|
|
34
35
|
⠏ Processing abc.webm ━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23% 0:00:04 00:15
|
|
35
36
|
```
|
|
36
|
-
|
|
37
37
|
Where:
|
|
38
38
|
- `Processing abc.webm` is the description of the progresss bar.
|
|
39
39
|
- `23%` is the percentage progress.
|
|
40
40
|
- `0:00:04` is the time (H:MM:SS) elapsed.
|
|
41
41
|
- `00:15` is the estimated time until the FFmpeg process completes.
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
As you can see, the output of Better FFmpeg Progress is much more useful.
|
|
44
44
|
|
|
45
|
+
## Installation
|
|
45
46
|
```
|
|
46
47
|
pip install better-ffmpeg-progress --upgrade
|
|
47
48
|
```
|
|
48
49
|
|
|
49
|
-
## Usage
|
|
50
|
-
|
|
50
|
+
## Usage
|
|
51
51
|
Create an instance of the `FfmpegProcess` class and supply a list of arguments like you would to `subprocess.run()`.
|
|
52
52
|
|
|
53
53
|
Simple Example:
|
|
54
|
-
|
|
55
54
|
```py
|
|
56
55
|
from better_ffmpeg_progress import FfmpegProcess
|
|
57
56
|
# Pass a list of FFmpeg arguments, like you would if using subprocess.run()
|
|
@@ -61,7 +60,6 @@ process.run()
|
|
|
61
60
|
```
|
|
62
61
|
|
|
63
62
|
Advanced Example:
|
|
64
|
-
|
|
65
63
|
```py
|
|
66
64
|
from better_ffmpeg_progress import FfmpegProcess
|
|
67
65
|
|
|
@@ -76,7 +74,7 @@ def handle_error():
|
|
|
76
74
|
# Code to run if the FFmpeg process encounters an error.
|
|
77
75
|
pass
|
|
78
76
|
|
|
79
|
-
# Pass a list of FFmpeg arguments, like you would if using subprocess.run()
|
|
77
|
+
# Pass a list of FFmpeg arguments, like you would if using subprocess.run() or subprocess.Popen()
|
|
80
78
|
process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "output.mp3"])
|
|
81
79
|
|
|
82
80
|
# Use the run method to run the FFmpeg command.
|
|
@@ -89,13 +87,17 @@ process.run(
|
|
|
89
87
|
)
|
|
90
88
|
```
|
|
91
89
|
|
|
90
|
+
## Optional Arguments
|
|
91
|
+
An instance of the `FfmpegProcess` class takes the following **optional** arguments:
|
|
92
|
+
|
|
93
|
+
- `ffmpeg_loglevel`: Desired FFmpeg log level. Default: "verbose"
|
|
94
|
+
- `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
|
|
95
|
+
- `print_detected_duration`: Print the detected duration of the input file. Default: True
|
|
96
|
+
|
|
92
97
|
The `run` method takes the following **optional** arguments:
|
|
93
98
|
- `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.
|
|
94
|
-
|
|
95
99
|
- `progress_handler`
|
|
96
|
-
|
|
97
100
|
- You can create a function if you would like to do something with the following values:
|
|
98
|
-
|
|
99
101
|
- Percentage progress. [float]
|
|
100
102
|
- Speed, e.g. `22.3x` which means that 22.3 seconds of the input are processed every second. [string]
|
|
101
103
|
- ETA in seconds. [float]
|
|
@@ -105,50 +107,38 @@ The `run` method takes the following **optional** arguments:
|
|
|
105
107
|
The values will be `None` if unknown. The function will receive the current values of these metrics as arguments, every 0.1s.
|
|
106
108
|
|
|
107
109
|
- `log_file` - The filepath to save the FFmpeg log to.
|
|
108
|
-
|
|
109
110
|
- `success_handler` - A function to run if the FFmpeg process completes successfully.
|
|
110
|
-
|
|
111
111
|
- `error_handler` - A function to run if the FFmpeg process encounters an error.
|
|
112
112
|
|
|
113
|
-
## Changelog
|
|
114
|
-
|
|
113
|
+
## Changelog
|
|
115
114
|
[19/09/2022]
|
|
116
|
-
|
|
117
115
|
- Add the ability to specify a `success_handler` argument, a function to run if the FFmpeg process completes successfully.
|
|
118
116
|
- Add 0.001 to tqdm's `total` parameter to prevent the chance of getting `TqdmWarning: clamping frac to range [0, 1]`
|
|
119
117
|
|
|
120
118
|
[21/12/2022]
|
|
121
|
-
|
|
122
119
|
- [v2.0.7] Fix `'estimated_size' referenced before assignment` error.
|
|
123
120
|
- [v2.0.7] The progress bar now uses 1 decimal place for seconds processed and total duration.
|
|
124
121
|
|
|
125
122
|
[22/12/2022]
|
|
126
|
-
|
|
127
123
|
- [v2.0.8] Add the ability to specify an `error_handler` argument, a function to run if the FFmpeg process encounters an error.
|
|
128
124
|
- [v2.0.9] Fix a typo (commit [da45a84](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/da45a8416856ab7d3c7b748db5703fa3dbc65f60))
|
|
129
125
|
|
|
130
126
|
[07/02/2022]
|
|
131
|
-
|
|
132
127
|
- [v2.1.0] [Update function name](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/572fe8a0d71957d00b833134a4d35170630203fa) to fix `'process_complete_handler' is not defined` error.
|
|
133
128
|
|
|
134
129
|
[05/11/2023]
|
|
135
|
-
|
|
136
130
|
- [v2.1.2] [Do not exit the Python interpreter after the FFmpeg process is complete](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/0a358810773835297faae688689c6e0d8a5859ae)
|
|
137
131
|
|
|
138
132
|
[22/04/2024]
|
|
139
|
-
|
|
140
133
|
- [v2.1.3] Fix issue [#20](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/20)
|
|
141
134
|
|
|
142
135
|
[28/04/2024]
|
|
143
|
-
|
|
144
136
|
- [v2.1.4] Fix issue [#21](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/21)
|
|
145
137
|
|
|
146
138
|
[02/05/2024]
|
|
147
|
-
|
|
148
139
|
- [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.
|
|
149
140
|
|
|
150
141
|
[18/10/2024]
|
|
151
|
-
|
|
152
142
|
- [v2.1.6] Notify the user if the input filepath or filename is incorrect.
|
|
153
143
|
- [v2.1.7] Refactor to use threads and queues.
|
|
154
144
|
|
|
@@ -172,3 +162,4 @@ The `run` method takes the following **optional** arguments:
|
|
|
172
162
|
[31/10/2024]
|
|
173
163
|
- [v2.4.0] Print FFmpeg stderr if better progress information cannot be shown.
|
|
174
164
|
- [v2.4.0] Flush the stream when printing FFmpeg stderr to ensure that it is printed immediately.
|
|
165
|
+
- [v2.5.0] Add an option to print FFmpeg stderr on a new line 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.5.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.4.1 → better_ffmpeg_progress-2.5.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
|