better-ffmpeg-progress 2.5.4__tar.gz → 2.5.6__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.4 → better_ffmpeg_progress-2.5.6}/PKG-INFO +5 -1
- {better_ffmpeg_progress-2.5.4 → better_ffmpeg_progress-2.5.6}/README.md +5 -1
- {better_ffmpeg_progress-2.5.4 → better_ffmpeg_progress-2.5.6}/better_ffmpeg_progress/better_ffmpeg_progress.py +45 -9
- {better_ffmpeg_progress-2.5.4 → better_ffmpeg_progress-2.5.6}/better_ffmpeg_progress.egg-info/PKG-INFO +5 -1
- {better_ffmpeg_progress-2.5.4 → better_ffmpeg_progress-2.5.6}/setup.py +1 -1
- {better_ffmpeg_progress-2.5.4 → better_ffmpeg_progress-2.5.6}/LICENSE +0 -0
- {better_ffmpeg_progress-2.5.4 → better_ffmpeg_progress-2.5.6}/better_ffmpeg_progress/__init__.py +0 -0
- {better_ffmpeg_progress-2.5.4 → better_ffmpeg_progress-2.5.6}/better_ffmpeg_progress.egg-info/SOURCES.txt +0 -0
- {better_ffmpeg_progress-2.5.4 → better_ffmpeg_progress-2.5.6}/better_ffmpeg_progress.egg-info/dependency_links.txt +0 -0
- {better_ffmpeg_progress-2.5.4 → better_ffmpeg_progress-2.5.6}/better_ffmpeg_progress.egg-info/requires.txt +0 -0
- {better_ffmpeg_progress-2.5.4 → better_ffmpeg_progress-2.5.6}/better_ffmpeg_progress.egg-info/top_level.txt +0 -0
- {better_ffmpeg_progress-2.5.4 → better_ffmpeg_progress-2.5.6}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: better-ffmpeg-progress
|
|
3
|
-
Version: 2.5.
|
|
3
|
+
Version: 2.5.6
|
|
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
|
|
@@ -172,3 +172,7 @@ The `run` method takes the following **optional** arguments:
|
|
|
172
172
|
- [v2.5.2] Drain any remaining FFmpeg stderr after the process ends.
|
|
173
173
|
- [v2.5.3] Write FFmpeg stderr to the log file in real time.
|
|
174
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.
|
|
@@ -153,4 +153,8 @@ The `run` method takes the following **optional** arguments:
|
|
|
153
153
|
[12/11/2024]
|
|
154
154
|
- [v2.5.2] Drain any remaining FFmpeg stderr after the process ends.
|
|
155
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.
|
|
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.
|
|
@@ -77,6 +77,7 @@ class FfmpegProcess:
|
|
|
77
77
|
self._duration_secs: Optional[float] = None
|
|
78
78
|
self._current_size: int = 0
|
|
79
79
|
self._ffmpeg_log_file: Optional[Path] = None
|
|
80
|
+
self._error_messages: list[str] = []
|
|
80
81
|
|
|
81
82
|
self._get_input_file_duration()
|
|
82
83
|
|
|
@@ -166,6 +167,11 @@ class FfmpegProcess:
|
|
|
166
167
|
finally:
|
|
167
168
|
pipe.close()
|
|
168
169
|
|
|
170
|
+
def _contains_shell_operators(self, command: List[str]) -> bool:
|
|
171
|
+
"""Check if the command contains shell operators."""
|
|
172
|
+
shell_operators = {"|", ">", "<", ">>", "&&", "||"}
|
|
173
|
+
return any(op in command for op in shell_operators)
|
|
174
|
+
|
|
169
175
|
def _start_process(
|
|
170
176
|
self,
|
|
171
177
|
progress_bar: Optional[Progress],
|
|
@@ -174,16 +180,22 @@ class FfmpegProcess:
|
|
|
174
180
|
) -> int:
|
|
175
181
|
creationflags = subprocess.CREATE_NEW_PROCESS_GROUP if os.name == "nt" else 0
|
|
176
182
|
|
|
183
|
+
# If command contains shell operators, turn the list into a string.
|
|
184
|
+
if self._contains_shell_operators(self._ffmpeg_command):
|
|
185
|
+
final_command = " ".join(self._ffmpeg_command)
|
|
186
|
+
else:
|
|
187
|
+
final_command = self._ffmpeg_command
|
|
188
|
+
|
|
177
189
|
self._write_to_log_file(
|
|
178
|
-
f"This file contains the log for the following command:\n{' '.join(
|
|
190
|
+
f"This file contains the log for the following command:\n{final_command if isinstance(final_command, str) else ' '.join(final_command)}\n",
|
|
179
191
|
)
|
|
180
192
|
|
|
181
193
|
process = subprocess.Popen(
|
|
182
|
-
|
|
194
|
+
final_command,
|
|
183
195
|
stdout=subprocess.PIPE,
|
|
184
196
|
stderr=subprocess.PIPE,
|
|
185
197
|
text=True,
|
|
186
|
-
shell=
|
|
198
|
+
shell=isinstance(final_command, str),
|
|
187
199
|
creationflags=creationflags,
|
|
188
200
|
)
|
|
189
201
|
|
|
@@ -195,15 +207,36 @@ class FfmpegProcess:
|
|
|
195
207
|
target=self._handle_pipe, args=(process.stderr, stderr_queue), daemon=True
|
|
196
208
|
).start()
|
|
197
209
|
|
|
210
|
+
error_words = [
|
|
211
|
+
"error",
|
|
212
|
+
"failed",
|
|
213
|
+
"invalid",
|
|
214
|
+
"trailing",
|
|
215
|
+
"unable",
|
|
216
|
+
"unknown",
|
|
217
|
+
"no such file",
|
|
218
|
+
"permission denied",
|
|
219
|
+
"not found",
|
|
220
|
+
"unrecognized",
|
|
221
|
+
"undefined",
|
|
222
|
+
"unsupported",
|
|
223
|
+
"does not exist",
|
|
224
|
+
"missing",
|
|
225
|
+
"not available",
|
|
226
|
+
"cannot",
|
|
227
|
+
"could not",
|
|
228
|
+
"bad",
|
|
229
|
+
"wrong",
|
|
230
|
+
"forbidden",
|
|
231
|
+
]
|
|
232
|
+
|
|
198
233
|
try:
|
|
199
234
|
while process.poll() is None:
|
|
200
235
|
if self._duration_secs is not None:
|
|
201
236
|
try:
|
|
202
237
|
stdout = stdout_queue.get_nowait()
|
|
203
|
-
|
|
204
238
|
if stdout:
|
|
205
239
|
metric, value = stdout.split("=")
|
|
206
|
-
|
|
207
240
|
if (
|
|
208
241
|
metric in self.WANTED_METRICS
|
|
209
242
|
and value
|
|
@@ -212,7 +245,6 @@ class FfmpegProcess:
|
|
|
212
245
|
self._update_metrics(
|
|
213
246
|
stdout, metric, value, progress_handler
|
|
214
247
|
)
|
|
215
|
-
|
|
216
248
|
if (
|
|
217
249
|
metric == "out_time_ms"
|
|
218
250
|
and progress_bar
|
|
@@ -228,10 +260,12 @@ class FfmpegProcess:
|
|
|
228
260
|
|
|
229
261
|
try:
|
|
230
262
|
stderr = stderr_queue.get_nowait()
|
|
231
|
-
|
|
232
263
|
if stderr:
|
|
233
264
|
self._write_to_log_file(stderr)
|
|
234
265
|
|
|
266
|
+
if any(keyword in stderr.lower() for keyword in error_words):
|
|
267
|
+
self._error_messages.append(stderr)
|
|
268
|
+
|
|
235
269
|
if self._duration_secs is None:
|
|
236
270
|
print(
|
|
237
271
|
stderr,
|
|
@@ -252,10 +286,12 @@ class FfmpegProcess:
|
|
|
252
286
|
while True:
|
|
253
287
|
try:
|
|
254
288
|
stderr = stderr_queue.get_nowait()
|
|
255
|
-
|
|
256
289
|
if stderr:
|
|
257
290
|
self._write_to_log_file(stderr)
|
|
258
291
|
|
|
292
|
+
if any(keyword in stderr.lower() for keyword in error_words):
|
|
293
|
+
self._error_messages.append(stderr)
|
|
294
|
+
|
|
259
295
|
if self._duration_secs is None:
|
|
260
296
|
print(
|
|
261
297
|
stderr,
|
|
@@ -338,7 +374,7 @@ class FfmpegProcess:
|
|
|
338
374
|
error_handler()
|
|
339
375
|
|
|
340
376
|
sys.exit(
|
|
341
|
-
f"FFmpeg process failed.
|
|
377
|
+
f"FFmpeg process failed with return code {return_code}.\nError(s):\n{"\n".join(self._error_messages)}\nCheck out '{self._ffmpeg_log_file}' for more details."
|
|
342
378
|
)
|
|
343
379
|
|
|
344
380
|
if success_handler:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: better-ffmpeg-progress
|
|
3
|
-
Version: 2.5.
|
|
3
|
+
Version: 2.5.6
|
|
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
|
|
@@ -172,3 +172,7 @@ The `run` method takes the following **optional** arguments:
|
|
|
172
172
|
- [v2.5.2] Drain any remaining FFmpeg stderr after the process ends.
|
|
173
173
|
- [v2.5.3] Write FFmpeg stderr to the log file in real time.
|
|
174
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.
|
|
@@ -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.5.
|
|
8
|
+
version="2.5.6",
|
|
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.4 → better_ffmpeg_progress-2.5.6}/better_ffmpeg_progress/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|