better-ffmpeg-progress 2.2.0__tar.gz → 2.2.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.2.0 → better_ffmpeg_progress-2.2.1}/PKG-INFO +5 -2
- {better_ffmpeg_progress-2.2.0 → better_ffmpeg_progress-2.2.1}/README.md +4 -1
- {better_ffmpeg_progress-2.2.0 → better_ffmpeg_progress-2.2.1}/better_ffmpeg_progress/better_ffmpeg_progress.py +40 -27
- {better_ffmpeg_progress-2.2.0 → better_ffmpeg_progress-2.2.1}/better_ffmpeg_progress.egg-info/PKG-INFO +5 -2
- {better_ffmpeg_progress-2.2.0 → better_ffmpeg_progress-2.2.1}/setup.py +1 -1
- {better_ffmpeg_progress-2.2.0 → better_ffmpeg_progress-2.2.1}/LICENSE +0 -0
- {better_ffmpeg_progress-2.2.0 → better_ffmpeg_progress-2.2.1}/better_ffmpeg_progress/__init__.py +0 -0
- {better_ffmpeg_progress-2.2.0 → better_ffmpeg_progress-2.2.1}/better_ffmpeg_progress.egg-info/SOURCES.txt +0 -0
- {better_ffmpeg_progress-2.2.0 → better_ffmpeg_progress-2.2.1}/better_ffmpeg_progress.egg-info/dependency_links.txt +0 -0
- {better_ffmpeg_progress-2.2.0 → better_ffmpeg_progress-2.2.1}/better_ffmpeg_progress.egg-info/requires.txt +0 -0
- {better_ffmpeg_progress-2.2.0 → better_ffmpeg_progress-2.2.1}/better_ffmpeg_progress.egg-info/top_level.txt +0 -0
- {better_ffmpeg_progress-2.2.0 → better_ffmpeg_progress-2.2.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: better-ffmpeg-progress
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.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
|
|
@@ -80,7 +80,7 @@ process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "out
|
|
|
80
80
|
|
|
81
81
|
# Use the run method to run the FFmpeg command.
|
|
82
82
|
process.run(
|
|
83
|
-
|
|
83
|
+
log_file="ffmpeg_output.txt",
|
|
84
84
|
progress_bar_description="Converting file...",
|
|
85
85
|
progress_handler=handle_progress_info,
|
|
86
86
|
success_handler=handle_success,
|
|
@@ -157,3 +157,6 @@ The `run` method takes the following **optional** arguments:
|
|
|
157
157
|
[20/10/2024]
|
|
158
158
|
- [v2.1.9] Do not clear the terminal before showing the progress bar.
|
|
159
159
|
- [v2.2.0] Add the ability to set a custom description for the progress bar.
|
|
160
|
+
|
|
161
|
+
[22/10/2020]
|
|
162
|
+
- [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.
|
|
@@ -63,7 +63,7 @@ process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "out
|
|
|
63
63
|
|
|
64
64
|
# Use the run method to run the FFmpeg command.
|
|
65
65
|
process.run(
|
|
66
|
-
|
|
66
|
+
log_file="ffmpeg_output.txt",
|
|
67
67
|
progress_bar_description="Converting file...",
|
|
68
68
|
progress_handler=handle_progress_info,
|
|
69
69
|
success_handler=handle_success,
|
|
@@ -140,3 +140,6 @@ The `run` method takes the following **optional** arguments:
|
|
|
140
140
|
[20/10/2024]
|
|
141
141
|
- [v2.1.9] Do not clear the terminal before showing the progress bar.
|
|
142
142
|
- [v2.2.0] Add the ability to set a custom description for the progress bar.
|
|
143
|
+
|
|
144
|
+
[22/10/2020]
|
|
145
|
+
- [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.
|
|
@@ -143,24 +143,23 @@ class FfmpegProcess:
|
|
|
143
143
|
pipe.close()
|
|
144
144
|
|
|
145
145
|
def _write_ffmpeg_output(
|
|
146
|
-
self,
|
|
146
|
+
self,
|
|
147
|
+
stderr_output: str,
|
|
148
|
+
log_file: Optional[Union[str, Path]],
|
|
149
|
+
is_error: bool = False,
|
|
147
150
|
) -> None:
|
|
148
151
|
"""Write FFmpeg stderr to a txt file."""
|
|
149
|
-
|
|
150
|
-
output_dir.mkdir(exist_ok=True)
|
|
152
|
+
Path(log_file).write_text(stderr_output)
|
|
151
153
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
+
if is_error:
|
|
155
|
+
return
|
|
154
156
|
|
|
155
|
-
log_file
|
|
156
|
-
print(f"Done! FFmpeg log file: {log_file}")
|
|
157
|
+
print(f"FFmpeg log written to: {log_file}")
|
|
157
158
|
|
|
158
159
|
def _start_process(
|
|
159
160
|
self,
|
|
160
161
|
progress_bar: Optional[Progress],
|
|
161
162
|
task_id: Optional[int],
|
|
162
|
-
success_handler: Optional[Callable],
|
|
163
|
-
error_handler: Optional[Callable],
|
|
164
163
|
progress_handler: Optional[Callable],
|
|
165
164
|
) -> None:
|
|
166
165
|
process = subprocess.Popen(
|
|
@@ -213,18 +212,11 @@ class FfmpegProcess:
|
|
|
213
212
|
except Empty:
|
|
214
213
|
pass
|
|
215
214
|
|
|
216
|
-
|
|
217
|
-
if error_handler:
|
|
218
|
-
error_handler()
|
|
219
|
-
else:
|
|
220
|
-
sys.exit("\nFFmpeg process failed")
|
|
221
|
-
|
|
222
|
-
if success_handler:
|
|
223
|
-
success_handler()
|
|
215
|
+
return process.returncode
|
|
224
216
|
|
|
225
217
|
def run(
|
|
226
218
|
self,
|
|
227
|
-
|
|
219
|
+
log_file: Optional[Union[str, Path]] = None,
|
|
228
220
|
progress_bar_description: str = None,
|
|
229
221
|
progress_handler: Optional[Callable] = None,
|
|
230
222
|
success_handler: Optional[Callable] = None,
|
|
@@ -232,7 +224,7 @@ class FfmpegProcess:
|
|
|
232
224
|
) -> None:
|
|
233
225
|
"""
|
|
234
226
|
Args:
|
|
235
|
-
|
|
227
|
+
log_file: Optional filepath to write FFmpeg output to
|
|
236
228
|
progress_bar_description: Optional string to set a custom description for the progress bar
|
|
237
229
|
progress_handler: Optional function which receives progress metrics
|
|
238
230
|
success_handler: Optional function to handle successful completion of the FFmpeg process
|
|
@@ -260,20 +252,41 @@ class FfmpegProcess:
|
|
|
260
252
|
total=self._duration_secs,
|
|
261
253
|
)
|
|
262
254
|
|
|
263
|
-
self._start_process(
|
|
255
|
+
return_code = self._start_process(
|
|
264
256
|
progress_bar,
|
|
265
257
|
task_id,
|
|
266
|
-
|
|
267
|
-
error_handler,
|
|
268
|
-
progress_handler,
|
|
258
|
+
None,
|
|
269
259
|
)
|
|
270
260
|
else:
|
|
271
|
-
self._start_process(
|
|
261
|
+
return_code = self._start_process(
|
|
272
262
|
None,
|
|
273
263
|
None,
|
|
274
|
-
success_handler,
|
|
275
|
-
error_handler,
|
|
276
264
|
progress_handler,
|
|
277
265
|
)
|
|
278
266
|
|
|
279
|
-
self.
|
|
267
|
+
self._handle_process_ended(
|
|
268
|
+
return_code, error_handler, success_handler, log_file
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
def _handle_process_ended(
|
|
272
|
+
self, return_code, error_handler, success_handler, log_file
|
|
273
|
+
):
|
|
274
|
+
if return_code != 0:
|
|
275
|
+
if error_handler:
|
|
276
|
+
error_handler()
|
|
277
|
+
|
|
278
|
+
ffmpeg_log_file = "ffmpeg_log.txt"
|
|
279
|
+
|
|
280
|
+
self._write_ffmpeg_output(
|
|
281
|
+
"\n".join(self._ffmpeg_stderr), ffmpeg_log_file, is_error=True
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
sys.exit(f"FFmpeg process failed. Check out {ffmpeg_log_file} for details")
|
|
285
|
+
|
|
286
|
+
if log_file:
|
|
287
|
+
self._write_ffmpeg_output("\n".join(self._ffmpeg_stderr), log_file)
|
|
288
|
+
|
|
289
|
+
if success_handler:
|
|
290
|
+
success_handler()
|
|
291
|
+
else:
|
|
292
|
+
print("FFmpeg process completed.")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: better-ffmpeg-progress
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.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
|
|
@@ -80,7 +80,7 @@ process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "out
|
|
|
80
80
|
|
|
81
81
|
# Use the run method to run the FFmpeg command.
|
|
82
82
|
process.run(
|
|
83
|
-
|
|
83
|
+
log_file="ffmpeg_output.txt",
|
|
84
84
|
progress_bar_description="Converting file...",
|
|
85
85
|
progress_handler=handle_progress_info,
|
|
86
86
|
success_handler=handle_success,
|
|
@@ -157,3 +157,6 @@ The `run` method takes the following **optional** arguments:
|
|
|
157
157
|
[20/10/2024]
|
|
158
158
|
- [v2.1.9] Do not clear the terminal before showing the progress bar.
|
|
159
159
|
- [v2.2.0] Add the ability to set a custom description for the progress bar.
|
|
160
|
+
|
|
161
|
+
[22/10/2020]
|
|
162
|
+
- [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.
|
|
@@ -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.2.
|
|
8
|
+
version="2.2.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.2.0 → better_ffmpeg_progress-2.2.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
|