better-ffmpeg-progress 2.4.1__tar.gz → 2.5.1__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.1}/PKG-INFO +25 -30
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.1}/README.md +25 -30
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.1}/better_ffmpeg_progress/better_ffmpeg_progress.py +11 -3
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.1}/better_ffmpeg_progress.egg-info/PKG-INFO +25 -30
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.1}/setup.py +1 -1
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.1}/LICENSE +0 -0
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.1}/better_ffmpeg_progress/__init__.py +0 -0
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.1}/better_ffmpeg_progress.egg-info/SOURCES.txt +0 -0
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.1}/better_ffmpeg_progress.egg-info/dependency_links.txt +0 -0
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.1}/better_ffmpeg_progress.egg-info/requires.txt +0 -0
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.1}/better_ffmpeg_progress.egg-info/top_level.txt +0 -0
- {better_ffmpeg_progress-2.4.1 → better_ffmpeg_progress-2.5.1}/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.1
|
|
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
|
|
@@ -19,39 +19,39 @@ Requires-Dist: rich
|
|
|
19
19
|
<div align="center">
|
|
20
20
|
|
|
21
21
|
[](https://pypistats.org/packages/better-ffmpeg-progress)
|
|
22
|
-
[](https://pypistats.org/packages/better-ffmpeg-progress)
|
|
23
|
+

|
|
23
24
|
[](LICENSE.txt)
|
|
24
25
|
|
|
25
26
|
# Better FFmpeg Progress
|
|
26
|
-
|
|
27
|
-
Runs an FFmpeg command and uses [Rich](https://github.com/Textualize/rich) to show a progress bar.
|
|
28
|
-
|
|
27
|
+
Runs an FFmpeg command and shows a progress bar with percentage progress, time elapsed and ETA.
|
|
29
28
|
</div>
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
FFmpeg outputs something like:
|
|
31
|
+
```
|
|
32
|
+
frame= 692 fps= 58 q=28.0 size= 5376KiB time=00:00:28.77 bitrate=1530.3kbits/s speed=2.43x
|
|
33
|
+
```
|
|
34
|
+
Better FFmpeg Progress outputs something like:
|
|
33
35
|
```
|
|
34
36
|
⠏ Processing abc.webm ━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23% 0:00:04 00:15
|
|
35
37
|
```
|
|
36
|
-
|
|
37
38
|
Where:
|
|
38
39
|
- `Processing abc.webm` is the description of the progresss bar.
|
|
39
40
|
- `23%` is the percentage progress.
|
|
40
41
|
- `0:00:04` is the time (H:MM:SS) elapsed.
|
|
41
42
|
- `00:15` is the estimated time until the FFmpeg process completes.
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
As you can see, the output of Better FFmpeg Progress is much more useful.
|
|
44
45
|
|
|
46
|
+
## Installation
|
|
45
47
|
```
|
|
46
48
|
pip install better-ffmpeg-progress --upgrade
|
|
47
49
|
```
|
|
48
50
|
|
|
49
|
-
## Usage
|
|
50
|
-
|
|
51
|
+
## Usage
|
|
51
52
|
Create an instance of the `FfmpegProcess` class and supply a list of arguments like you would to `subprocess.run()`.
|
|
52
53
|
|
|
53
54
|
Simple Example:
|
|
54
|
-
|
|
55
55
|
```py
|
|
56
56
|
from better_ffmpeg_progress import FfmpegProcess
|
|
57
57
|
# Pass a list of FFmpeg arguments, like you would if using subprocess.run()
|
|
@@ -61,7 +61,6 @@ process.run()
|
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
Advanced Example:
|
|
64
|
-
|
|
65
64
|
```py
|
|
66
65
|
from better_ffmpeg_progress import FfmpegProcess
|
|
67
66
|
|
|
@@ -76,7 +75,7 @@ def handle_error():
|
|
|
76
75
|
# Code to run if the FFmpeg process encounters an error.
|
|
77
76
|
pass
|
|
78
77
|
|
|
79
|
-
# Pass a list of FFmpeg arguments, like you would if using subprocess.run()
|
|
78
|
+
# Pass a list of FFmpeg arguments, like you would if using subprocess.run() or subprocess.Popen()
|
|
80
79
|
process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "output.mp3"])
|
|
81
80
|
|
|
82
81
|
# Use the run method to run the FFmpeg command.
|
|
@@ -89,13 +88,17 @@ process.run(
|
|
|
89
88
|
)
|
|
90
89
|
```
|
|
91
90
|
|
|
91
|
+
## Optional Arguments
|
|
92
|
+
An instance of the `FfmpegProcess` class takes the following **optional** arguments:
|
|
93
|
+
|
|
94
|
+
- `ffmpeg_loglevel`: Desired FFmpeg log level. Default: "verbose"
|
|
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
|
+
- `print_detected_duration`: Print the detected duration of the input file. Default: True
|
|
97
|
+
|
|
92
98
|
The `run` method takes the following **optional** arguments:
|
|
93
99
|
- `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
100
|
- `progress_handler`
|
|
96
|
-
|
|
97
101
|
- You can create a function if you would like to do something with the following values:
|
|
98
|
-
|
|
99
102
|
- Percentage progress. [float]
|
|
100
103
|
- Speed, e.g. `22.3x` which means that 22.3 seconds of the input are processed every second. [string]
|
|
101
104
|
- ETA in seconds. [float]
|
|
@@ -105,50 +108,38 @@ The `run` method takes the following **optional** arguments:
|
|
|
105
108
|
The values will be `None` if unknown. The function will receive the current values of these metrics as arguments, every 0.1s.
|
|
106
109
|
|
|
107
110
|
- `log_file` - The filepath to save the FFmpeg log to.
|
|
108
|
-
|
|
109
111
|
- `success_handler` - A function to run if the FFmpeg process completes successfully.
|
|
110
|
-
|
|
111
112
|
- `error_handler` - A function to run if the FFmpeg process encounters an error.
|
|
112
113
|
|
|
113
|
-
## Changelog
|
|
114
|
-
|
|
114
|
+
## Changelog
|
|
115
115
|
[19/09/2022]
|
|
116
|
-
|
|
117
116
|
- Add the ability to specify a `success_handler` argument, a function to run if the FFmpeg process completes successfully.
|
|
118
117
|
- Add 0.001 to tqdm's `total` parameter to prevent the chance of getting `TqdmWarning: clamping frac to range [0, 1]`
|
|
119
118
|
|
|
120
119
|
[21/12/2022]
|
|
121
|
-
|
|
122
120
|
- [v2.0.7] Fix `'estimated_size' referenced before assignment` error.
|
|
123
121
|
- [v2.0.7] The progress bar now uses 1 decimal place for seconds processed and total duration.
|
|
124
122
|
|
|
125
123
|
[22/12/2022]
|
|
126
|
-
|
|
127
124
|
- [v2.0.8] Add the ability to specify an `error_handler` argument, a function to run if the FFmpeg process encounters an error.
|
|
128
125
|
- [v2.0.9] Fix a typo (commit [da45a84](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/da45a8416856ab7d3c7b748db5703fa3dbc65f60))
|
|
129
126
|
|
|
130
127
|
[07/02/2022]
|
|
131
|
-
|
|
132
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.
|
|
133
129
|
|
|
134
130
|
[05/11/2023]
|
|
135
|
-
|
|
136
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)
|
|
137
132
|
|
|
138
133
|
[22/04/2024]
|
|
139
|
-
|
|
140
134
|
- [v2.1.3] Fix issue [#20](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/20)
|
|
141
135
|
|
|
142
136
|
[28/04/2024]
|
|
143
|
-
|
|
144
137
|
- [v2.1.4] Fix issue [#21](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/21)
|
|
145
138
|
|
|
146
139
|
[02/05/2024]
|
|
147
|
-
|
|
148
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.
|
|
149
141
|
|
|
150
142
|
[18/10/2024]
|
|
151
|
-
|
|
152
143
|
- [v2.1.6] Notify the user if the input filepath or filename is incorrect.
|
|
153
144
|
- [v2.1.7] Refactor to use threads and queues.
|
|
154
145
|
|
|
@@ -172,3 +163,7 @@ The `run` method takes the following **optional** arguments:
|
|
|
172
163
|
[31/10/2024]
|
|
173
164
|
- [v2.4.0] Print FFmpeg stderr if better progress information cannot be shown.
|
|
174
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.
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
3
|
[](https://pypistats.org/packages/better-ffmpeg-progress)
|
|
4
|
-
[](https://pypistats.org/packages/better-ffmpeg-progress)
|
|
5
|
+

|
|
5
6
|
[](LICENSE.txt)
|
|
6
7
|
|
|
7
8
|
# Better FFmpeg Progress
|
|
8
|
-
|
|
9
|
-
Runs an FFmpeg command and uses [Rich](https://github.com/Textualize/rich) to show a progress bar.
|
|
10
|
-
|
|
9
|
+
Runs an FFmpeg command and shows a progress bar with percentage progress, time elapsed and ETA.
|
|
11
10
|
</div>
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
FFmpeg outputs something like:
|
|
13
|
+
```
|
|
14
|
+
frame= 692 fps= 58 q=28.0 size= 5376KiB time=00:00:28.77 bitrate=1530.3kbits/s speed=2.43x
|
|
15
|
+
```
|
|
16
|
+
Better FFmpeg Progress outputs something like:
|
|
15
17
|
```
|
|
16
18
|
⠏ Processing abc.webm ━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23% 0:00:04 00:15
|
|
17
19
|
```
|
|
18
|
-
|
|
19
20
|
Where:
|
|
20
21
|
- `Processing abc.webm` is the description of the progresss bar.
|
|
21
22
|
- `23%` is the percentage progress.
|
|
22
23
|
- `0:00:04` is the time (H:MM:SS) elapsed.
|
|
23
24
|
- `00:15` is the estimated time until the FFmpeg process completes.
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
As you can see, the output of Better FFmpeg Progress is much more useful.
|
|
26
27
|
|
|
28
|
+
## Installation
|
|
27
29
|
```
|
|
28
30
|
pip install better-ffmpeg-progress --upgrade
|
|
29
31
|
```
|
|
30
32
|
|
|
31
|
-
## Usage
|
|
32
|
-
|
|
33
|
+
## Usage
|
|
33
34
|
Create an instance of the `FfmpegProcess` class and supply a list of arguments like you would to `subprocess.run()`.
|
|
34
35
|
|
|
35
36
|
Simple Example:
|
|
36
|
-
|
|
37
37
|
```py
|
|
38
38
|
from better_ffmpeg_progress import FfmpegProcess
|
|
39
39
|
# Pass a list of FFmpeg arguments, like you would if using subprocess.run()
|
|
@@ -43,7 +43,6 @@ process.run()
|
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Advanced Example:
|
|
46
|
-
|
|
47
46
|
```py
|
|
48
47
|
from better_ffmpeg_progress import FfmpegProcess
|
|
49
48
|
|
|
@@ -58,7 +57,7 @@ def handle_error():
|
|
|
58
57
|
# Code to run if the FFmpeg process encounters an error.
|
|
59
58
|
pass
|
|
60
59
|
|
|
61
|
-
# Pass a list of FFmpeg arguments, like you would if using subprocess.run()
|
|
60
|
+
# Pass a list of FFmpeg arguments, like you would if using subprocess.run() or subprocess.Popen()
|
|
62
61
|
process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "output.mp3"])
|
|
63
62
|
|
|
64
63
|
# Use the run method to run the FFmpeg command.
|
|
@@ -71,13 +70,17 @@ process.run(
|
|
|
71
70
|
)
|
|
72
71
|
```
|
|
73
72
|
|
|
73
|
+
## Optional Arguments
|
|
74
|
+
An instance of the `FfmpegProcess` class takes the following **optional** arguments:
|
|
75
|
+
|
|
76
|
+
- `ffmpeg_loglevel`: Desired FFmpeg log level. Default: "verbose"
|
|
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
|
+
- `print_detected_duration`: Print the detected duration of the input file. Default: True
|
|
79
|
+
|
|
74
80
|
The `run` method takes the following **optional** arguments:
|
|
75
81
|
- `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
82
|
- `progress_handler`
|
|
78
|
-
|
|
79
83
|
- You can create a function if you would like to do something with the following values:
|
|
80
|
-
|
|
81
84
|
- Percentage progress. [float]
|
|
82
85
|
- Speed, e.g. `22.3x` which means that 22.3 seconds of the input are processed every second. [string]
|
|
83
86
|
- ETA in seconds. [float]
|
|
@@ -87,50 +90,38 @@ The `run` method takes the following **optional** arguments:
|
|
|
87
90
|
The values will be `None` if unknown. The function will receive the current values of these metrics as arguments, every 0.1s.
|
|
88
91
|
|
|
89
92
|
- `log_file` - The filepath to save the FFmpeg log to.
|
|
90
|
-
|
|
91
93
|
- `success_handler` - A function to run if the FFmpeg process completes successfully.
|
|
92
|
-
|
|
93
94
|
- `error_handler` - A function to run if the FFmpeg process encounters an error.
|
|
94
95
|
|
|
95
|
-
## Changelog
|
|
96
|
-
|
|
96
|
+
## Changelog
|
|
97
97
|
[19/09/2022]
|
|
98
|
-
|
|
99
98
|
- Add the ability to specify a `success_handler` argument, a function to run if the FFmpeg process completes successfully.
|
|
100
99
|
- Add 0.001 to tqdm's `total` parameter to prevent the chance of getting `TqdmWarning: clamping frac to range [0, 1]`
|
|
101
100
|
|
|
102
101
|
[21/12/2022]
|
|
103
|
-
|
|
104
102
|
- [v2.0.7] Fix `'estimated_size' referenced before assignment` error.
|
|
105
103
|
- [v2.0.7] The progress bar now uses 1 decimal place for seconds processed and total duration.
|
|
106
104
|
|
|
107
105
|
[22/12/2022]
|
|
108
|
-
|
|
109
106
|
- [v2.0.8] Add the ability to specify an `error_handler` argument, a function to run if the FFmpeg process encounters an error.
|
|
110
107
|
- [v2.0.9] Fix a typo (commit [da45a84](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/da45a8416856ab7d3c7b748db5703fa3dbc65f60))
|
|
111
108
|
|
|
112
109
|
[07/02/2022]
|
|
113
|
-
|
|
114
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.
|
|
115
111
|
|
|
116
112
|
[05/11/2023]
|
|
117
|
-
|
|
118
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)
|
|
119
114
|
|
|
120
115
|
[22/04/2024]
|
|
121
|
-
|
|
122
116
|
- [v2.1.3] Fix issue [#20](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/20)
|
|
123
117
|
|
|
124
118
|
[28/04/2024]
|
|
125
|
-
|
|
126
119
|
- [v2.1.4] Fix issue [#21](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/21)
|
|
127
120
|
|
|
128
121
|
[02/05/2024]
|
|
129
|
-
|
|
130
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.
|
|
131
123
|
|
|
132
124
|
[18/10/2024]
|
|
133
|
-
|
|
134
125
|
- [v2.1.6] Notify the user if the input filepath or filename is incorrect.
|
|
135
126
|
- [v2.1.7] Refactor to use threads and queues.
|
|
136
127
|
|
|
@@ -153,4 +144,8 @@ The `run` method takes the following **optional** arguments:
|
|
|
153
144
|
|
|
154
145
|
[31/10/2024]
|
|
155
146
|
- [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.
|
|
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.
|
|
@@ -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:
|
|
@@ -302,7 +310,7 @@ class FfmpegProcess:
|
|
|
302
310
|
if error_handler:
|
|
303
311
|
error_handler()
|
|
304
312
|
|
|
305
|
-
ffmpeg_log_file = "ffmpeg_log.txt"
|
|
313
|
+
ffmpeg_log_file = log_file if log_file else "ffmpeg_log.txt"
|
|
306
314
|
|
|
307
315
|
self._write_ffmpeg_output(
|
|
308
316
|
"\n".join(self._ffmpeg_stderr), ffmpeg_log_file, is_error=True
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: better-ffmpeg-progress
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.1
|
|
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
|
|
@@ -19,39 +19,39 @@ Requires-Dist: rich
|
|
|
19
19
|
<div align="center">
|
|
20
20
|
|
|
21
21
|
[](https://pypistats.org/packages/better-ffmpeg-progress)
|
|
22
|
-
[](https://pypistats.org/packages/better-ffmpeg-progress)
|
|
23
|
+

|
|
23
24
|
[](LICENSE.txt)
|
|
24
25
|
|
|
25
26
|
# Better FFmpeg Progress
|
|
26
|
-
|
|
27
|
-
Runs an FFmpeg command and uses [Rich](https://github.com/Textualize/rich) to show a progress bar.
|
|
28
|
-
|
|
27
|
+
Runs an FFmpeg command and shows a progress bar with percentage progress, time elapsed and ETA.
|
|
29
28
|
</div>
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
FFmpeg outputs something like:
|
|
31
|
+
```
|
|
32
|
+
frame= 692 fps= 58 q=28.0 size= 5376KiB time=00:00:28.77 bitrate=1530.3kbits/s speed=2.43x
|
|
33
|
+
```
|
|
34
|
+
Better FFmpeg Progress outputs something like:
|
|
33
35
|
```
|
|
34
36
|
⠏ Processing abc.webm ━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23% 0:00:04 00:15
|
|
35
37
|
```
|
|
36
|
-
|
|
37
38
|
Where:
|
|
38
39
|
- `Processing abc.webm` is the description of the progresss bar.
|
|
39
40
|
- `23%` is the percentage progress.
|
|
40
41
|
- `0:00:04` is the time (H:MM:SS) elapsed.
|
|
41
42
|
- `00:15` is the estimated time until the FFmpeg process completes.
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
As you can see, the output of Better FFmpeg Progress is much more useful.
|
|
44
45
|
|
|
46
|
+
## Installation
|
|
45
47
|
```
|
|
46
48
|
pip install better-ffmpeg-progress --upgrade
|
|
47
49
|
```
|
|
48
50
|
|
|
49
|
-
## Usage
|
|
50
|
-
|
|
51
|
+
## Usage
|
|
51
52
|
Create an instance of the `FfmpegProcess` class and supply a list of arguments like you would to `subprocess.run()`.
|
|
52
53
|
|
|
53
54
|
Simple Example:
|
|
54
|
-
|
|
55
55
|
```py
|
|
56
56
|
from better_ffmpeg_progress import FfmpegProcess
|
|
57
57
|
# Pass a list of FFmpeg arguments, like you would if using subprocess.run()
|
|
@@ -61,7 +61,6 @@ process.run()
|
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
Advanced Example:
|
|
64
|
-
|
|
65
64
|
```py
|
|
66
65
|
from better_ffmpeg_progress import FfmpegProcess
|
|
67
66
|
|
|
@@ -76,7 +75,7 @@ def handle_error():
|
|
|
76
75
|
# Code to run if the FFmpeg process encounters an error.
|
|
77
76
|
pass
|
|
78
77
|
|
|
79
|
-
# Pass a list of FFmpeg arguments, like you would if using subprocess.run()
|
|
78
|
+
# Pass a list of FFmpeg arguments, like you would if using subprocess.run() or subprocess.Popen()
|
|
80
79
|
process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "output.mp3"])
|
|
81
80
|
|
|
82
81
|
# Use the run method to run the FFmpeg command.
|
|
@@ -89,13 +88,17 @@ process.run(
|
|
|
89
88
|
)
|
|
90
89
|
```
|
|
91
90
|
|
|
91
|
+
## Optional Arguments
|
|
92
|
+
An instance of the `FfmpegProcess` class takes the following **optional** arguments:
|
|
93
|
+
|
|
94
|
+
- `ffmpeg_loglevel`: Desired FFmpeg log level. Default: "verbose"
|
|
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
|
+
- `print_detected_duration`: Print the detected duration of the input file. Default: True
|
|
97
|
+
|
|
92
98
|
The `run` method takes the following **optional** arguments:
|
|
93
99
|
- `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
100
|
- `progress_handler`
|
|
96
|
-
|
|
97
101
|
- You can create a function if you would like to do something with the following values:
|
|
98
|
-
|
|
99
102
|
- Percentage progress. [float]
|
|
100
103
|
- Speed, e.g. `22.3x` which means that 22.3 seconds of the input are processed every second. [string]
|
|
101
104
|
- ETA in seconds. [float]
|
|
@@ -105,50 +108,38 @@ The `run` method takes the following **optional** arguments:
|
|
|
105
108
|
The values will be `None` if unknown. The function will receive the current values of these metrics as arguments, every 0.1s.
|
|
106
109
|
|
|
107
110
|
- `log_file` - The filepath to save the FFmpeg log to.
|
|
108
|
-
|
|
109
111
|
- `success_handler` - A function to run if the FFmpeg process completes successfully.
|
|
110
|
-
|
|
111
112
|
- `error_handler` - A function to run if the FFmpeg process encounters an error.
|
|
112
113
|
|
|
113
|
-
## Changelog
|
|
114
|
-
|
|
114
|
+
## Changelog
|
|
115
115
|
[19/09/2022]
|
|
116
|
-
|
|
117
116
|
- Add the ability to specify a `success_handler` argument, a function to run if the FFmpeg process completes successfully.
|
|
118
117
|
- Add 0.001 to tqdm's `total` parameter to prevent the chance of getting `TqdmWarning: clamping frac to range [0, 1]`
|
|
119
118
|
|
|
120
119
|
[21/12/2022]
|
|
121
|
-
|
|
122
120
|
- [v2.0.7] Fix `'estimated_size' referenced before assignment` error.
|
|
123
121
|
- [v2.0.7] The progress bar now uses 1 decimal place for seconds processed and total duration.
|
|
124
122
|
|
|
125
123
|
[22/12/2022]
|
|
126
|
-
|
|
127
124
|
- [v2.0.8] Add the ability to specify an `error_handler` argument, a function to run if the FFmpeg process encounters an error.
|
|
128
125
|
- [v2.0.9] Fix a typo (commit [da45a84](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/da45a8416856ab7d3c7b748db5703fa3dbc65f60))
|
|
129
126
|
|
|
130
127
|
[07/02/2022]
|
|
131
|
-
|
|
132
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.
|
|
133
129
|
|
|
134
130
|
[05/11/2023]
|
|
135
|
-
|
|
136
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)
|
|
137
132
|
|
|
138
133
|
[22/04/2024]
|
|
139
|
-
|
|
140
134
|
- [v2.1.3] Fix issue [#20](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/20)
|
|
141
135
|
|
|
142
136
|
[28/04/2024]
|
|
143
|
-
|
|
144
137
|
- [v2.1.4] Fix issue [#21](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/21)
|
|
145
138
|
|
|
146
139
|
[02/05/2024]
|
|
147
|
-
|
|
148
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.
|
|
149
141
|
|
|
150
142
|
[18/10/2024]
|
|
151
|
-
|
|
152
143
|
- [v2.1.6] Notify the user if the input filepath or filename is incorrect.
|
|
153
144
|
- [v2.1.7] Refactor to use threads and queues.
|
|
154
145
|
|
|
@@ -172,3 +163,7 @@ The `run` method takes the following **optional** arguments:
|
|
|
172
163
|
[31/10/2024]
|
|
173
164
|
- [v2.4.0] Print FFmpeg stderr if better progress information cannot be shown.
|
|
174
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.
|
|
@@ -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.1",
|
|
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.1}/better_ffmpeg_progress/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|