better-ffmpeg-progress 2.2.1__tar.gz → 2.3.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: better-ffmpeg-progress
3
- Version: 2.2.1
3
+ Version: 2.3.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
@@ -80,9 +80,9 @@ 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
- log_file="ffmpeg_output.txt",
84
83
  progress_bar_description="Converting file...",
85
84
  progress_handler=handle_progress_info,
85
+ log_file="ffmpeg_log.txt",
86
86
  success_handler=handle_success,
87
87
  error_handler=handle_error,
88
88
  )
@@ -103,7 +103,7 @@ The `run` method takes the following **optional** arguments:
103
103
 
104
104
  The values will be `None` if unknown. The function will receive the current values of these metrics as arguments, every 0.1s.
105
105
 
106
- - `output_file` - A string path to define where you want the output of FFmpeg to be saved. By default, this is saved in a folder named "ffmpeg_output", with the filename `[<input_filename>].txt`.
106
+ - `log_file` - The filepath to save the FFmpeg log to.
107
107
 
108
108
  - `success_handler` - A function to run if the FFmpeg process completes successfully.
109
109
 
@@ -158,5 +158,11 @@ The `run` method takes the following **optional** arguments:
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
160
 
161
- [22/10/2020]
161
+ [22/10/2024]
162
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.
163
+
164
+ [28/10/2024]
165
+ - [v2.2.2] Make printing the detected duration of the input file optional.
166
+
167
+ [29/10/2024]
168
+ - [v2.3.0] Set `shell=True` to support piping.
@@ -63,9 +63,9 @@ 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
- log_file="ffmpeg_output.txt",
67
66
  progress_bar_description="Converting file...",
68
67
  progress_handler=handle_progress_info,
68
+ log_file="ffmpeg_log.txt",
69
69
  success_handler=handle_success,
70
70
  error_handler=handle_error,
71
71
  )
@@ -86,7 +86,7 @@ The `run` method takes the following **optional** arguments:
86
86
 
87
87
  The values will be `None` if unknown. The function will receive the current values of these metrics as arguments, every 0.1s.
88
88
 
89
- - `output_file` - A string path to define where you want the output of FFmpeg to be saved. By default, this is saved in a folder named "ffmpeg_output", with the filename `[<input_filename>].txt`.
89
+ - `log_file` - The filepath to save the FFmpeg log to.
90
90
 
91
91
  - `success_handler` - A function to run if the FFmpeg process completes successfully.
92
92
 
@@ -141,5 +141,11 @@ The `run` method takes the following **optional** arguments:
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
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.
144
+ [22/10/2024]
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.
146
+
147
+ [28/10/2024]
148
+ - [v2.2.2] Make printing the detected duration of the input file optional.
149
+
150
+ [29/10/2024]
151
+ - [v2.3.0] Set `shell=True` to support piping.
@@ -42,13 +42,19 @@ class FfmpegProcess:
42
42
 
43
43
  WANTED_METRICS = frozenset({"out_time_ms", "total_size", "speed"})
44
44
 
45
- def __init__(self, command: List[str], ffmpeg_loglevel: str = "verbose"):
45
+ def __init__(
46
+ self,
47
+ command: List[str],
48
+ ffmpeg_loglevel: str = "verbose",
49
+ print_detected_duration: bool = True,
50
+ ):
46
51
  if "-i" not in command:
47
52
  raise ValueError("FFmpeg command must include '-i'")
48
53
 
49
54
  self._ffmpeg_args = command + ["-hide_banner", "-loglevel", ffmpeg_loglevel]
50
55
  self._ffmpeg_stderr: List[str] = []
51
56
  self._output_filepath = Path(command[-1])
57
+ self._print_detected_duration = print_detected_duration
52
58
  self._metrics = Metrics()
53
59
  self._duration_secs: Optional[float] = None
54
60
  self._current_size: int = 0
@@ -64,9 +70,12 @@ class FfmpegProcess:
64
70
  self._duration_secs = float(
65
71
  probe(self._input_filepath)["format"]["duration"]
66
72
  )
67
- print(
68
- f"The duration of {self._input_filepath.name} has been detected as {self._duration_secs} seconds"
69
- )
73
+
74
+ if self._print_detected_duration:
75
+ print(
76
+ f"The duration of {self._input_filepath.name} has been detected as {self._duration_secs} seconds"
77
+ )
78
+
70
79
  # -progress pipe:1 sends progress metrics to stdout AND -stats_period sets the period at which encoding progress/statistics are updated
71
80
  # -nostats disables encoding progress/statistics in stderr
72
81
  self._ffmpeg_args.extend(
@@ -167,6 +176,7 @@ class FfmpegProcess:
167
176
  stdout=subprocess.PIPE,
168
177
  stderr=subprocess.PIPE,
169
178
  text=True,
179
+ shell=True,
170
180
  )
171
181
 
172
182
  stdout_queue, stderr_queue = Queue(), Queue()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: better-ffmpeg-progress
3
- Version: 2.2.1
3
+ Version: 2.3.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
@@ -80,9 +80,9 @@ 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
- log_file="ffmpeg_output.txt",
84
83
  progress_bar_description="Converting file...",
85
84
  progress_handler=handle_progress_info,
85
+ log_file="ffmpeg_log.txt",
86
86
  success_handler=handle_success,
87
87
  error_handler=handle_error,
88
88
  )
@@ -103,7 +103,7 @@ The `run` method takes the following **optional** arguments:
103
103
 
104
104
  The values will be `None` if unknown. The function will receive the current values of these metrics as arguments, every 0.1s.
105
105
 
106
- - `output_file` - A string path to define where you want the output of FFmpeg to be saved. By default, this is saved in a folder named "ffmpeg_output", with the filename `[<input_filename>].txt`.
106
+ - `log_file` - The filepath to save the FFmpeg log to.
107
107
 
108
108
  - `success_handler` - A function to run if the FFmpeg process completes successfully.
109
109
 
@@ -158,5 +158,11 @@ The `run` method takes the following **optional** arguments:
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
160
 
161
- [22/10/2020]
161
+ [22/10/2024]
162
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.
163
+
164
+ [28/10/2024]
165
+ - [v2.2.2] Make printing the detected duration of the input file optional.
166
+
167
+ [29/10/2024]
168
+ - [v2.3.0] Set `shell=True` to support piping.
@@ -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.1",
8
+ version="2.3.0",
9
9
  author="GitHub.com/CrypticSignal",
10
10
  author_email="theaudiophile@outlook.com",
11
11
  description="Run FFmpeg & see percentage progress + ETA.",