HwCodecDetect 0.1.0__tar.gz → 0.1.2__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.
Files changed (22) hide show
  1. {hwcodecdetect-0.1.0/src/HwCodecDetect.egg-info → hwcodecdetect-0.1.2}/PKG-INFO +4 -4
  2. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2}/README.md +3 -3
  3. hwcodecdetect-0.1.2/VERSION +1 -0
  4. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2}/pyproject.toml +6 -5
  5. hwcodecdetect-0.1.2/requirements.txt +2 -0
  6. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2}/setup.py +5 -1
  7. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2}/src/HwCodecDetect/install_ffmpeg_if_needed.py +40 -16
  8. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2}/src/HwCodecDetect/run_tests.py +47 -10
  9. hwcodecdetect-0.1.2/src/HwCodecDetect/version.py +1 -0
  10. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2/src/HwCodecDetect.egg-info}/PKG-INFO +4 -4
  11. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2}/src/HwCodecDetect.egg-info/SOURCES.txt +1 -0
  12. hwcodecdetect-0.1.0/VERSION +0 -1
  13. hwcodecdetect-0.1.0/src/HwCodecDetect/version.py +0 -1
  14. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2}/LICENSE +0 -0
  15. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2}/MANIFEST.in +0 -0
  16. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2}/setup.cfg +0 -0
  17. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2}/src/HwCodecDetect/__init__.py +0 -0
  18. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2}/src/HwCodecDetect.egg-info/dependency_links.txt +0 -0
  19. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2}/src/HwCodecDetect.egg-info/entry_points.txt +0 -0
  20. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2}/src/HwCodecDetect.egg-info/requires.txt +0 -0
  21. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2}/src/HwCodecDetect.egg-info/top_level.txt +0 -0
  22. {hwcodecdetect-0.1.0 → hwcodecdetect-0.1.2}/src/HwCodecDetect.egg-info/zip-safe +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: HwCodecDetect
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A cross-platform tool to automatically detect and test hardware video decoders/encoders using FFmpeg.
5
5
  Home-page: https://github.com/whyb/HwCodecDetect
6
6
  Author: whyb
@@ -23,7 +23,7 @@ Dynamic: home-page
23
23
  Dynamic: license-file
24
24
  Dynamic: requires-python
25
25
 
26
- # FFmpeg Hardware Codec Test Script(HwCodecDetect)
26
+ # FFmpeg Hardware Codec Detect Script(HwCodecDetect)
27
27
  <p align="center">
28
28
  <a href="https://github.com/whyb/HwCodecDetect/actions/workflows/run-test.yml">
29
29
  <img src="https://github.com/whyb/HwCodecDetect/actions/workflows/run-test.yml/badge.svg" />
@@ -46,7 +46,7 @@ This project was created to solve this very problem. It's a convenient tool for
46
46
 
47
47
  ## Key Features
48
48
  ### Encoders
49
- The script automatically tests and reports on the following major hardware encoders and their supported formats:
49
+ The script automatically detect and reports on the following major hardware encoders and their supported formats:
50
50
  | Encoder Name | Supported Video Formats |
51
51
  |------------------------------------------|------------------------------------------- |
52
52
  | NVEnc | H.264、H.265、AV1 |
@@ -59,7 +59,7 @@ The script automatically tests and reports on the following major hardware encod
59
59
  | Apple VideoToolbox | H.264、H.265 |
60
60
 
61
61
  ### Decoders
62
- The script automatically tests and reports on the following major hardware decoders and their supported formats:
62
+ The script automatically detect and reports on the following major hardware decoders and their supported formats:
63
63
  | Decoder Name | Supported Video Formats |
64
64
  |------------------------------------------ |------------------------------------------------------------- |
65
65
  | NVDec (CUVID) | H.264、H.265、AV1、MJPEG、MPEG-1、MPEG-2、MPEG-4、VP8、VP9 |
@@ -1,4 +1,4 @@
1
- # FFmpeg Hardware Codec Test Script(HwCodecDetect)
1
+ # FFmpeg Hardware Codec Detect Script(HwCodecDetect)
2
2
  <p align="center">
3
3
  <a href="https://github.com/whyb/HwCodecDetect/actions/workflows/run-test.yml">
4
4
  <img src="https://github.com/whyb/HwCodecDetect/actions/workflows/run-test.yml/badge.svg" />
@@ -21,7 +21,7 @@ This project was created to solve this very problem. It's a convenient tool for
21
21
 
22
22
  ## Key Features
23
23
  ### Encoders
24
- The script automatically tests and reports on the following major hardware encoders and their supported formats:
24
+ The script automatically detect and reports on the following major hardware encoders and their supported formats:
25
25
  | Encoder Name | Supported Video Formats |
26
26
  |------------------------------------------|------------------------------------------- |
27
27
  | NVEnc | H.264、H.265、AV1 |
@@ -34,7 +34,7 @@ The script automatically tests and reports on the following major hardware encod
34
34
  | Apple VideoToolbox | H.264、H.265 |
35
35
 
36
36
  ### Decoders
37
- The script automatically tests and reports on the following major hardware decoders and their supported formats:
37
+ The script automatically detect and reports on the following major hardware decoders and their supported formats:
38
38
  | Decoder Name | Supported Video Formats |
39
39
  |------------------------------------------ |------------------------------------------------------------- |
40
40
  | NVDec (CUVID) | H.264、H.265、AV1、MJPEG、MPEG-1、MPEG-2、MPEG-4、VP8、VP9 |
@@ -0,0 +1 @@
1
+ 0.1.2
@@ -4,7 +4,6 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "HwCodecDetect"
7
- version = "0.1.0"
8
7
  authors = [
9
8
  { name="whyb", email="whyber@outlook.com" },
10
9
  ]
@@ -15,10 +14,7 @@ license = "BSD-3-Clause"
15
14
  license-files = [
16
15
  "LICENSE",
17
16
  ]
18
- dependencies = [
19
- "colorama",
20
- "tqdm"
21
- ]
17
+
22
18
  classifiers = [
23
19
  "Programming Language :: Python :: 3",
24
20
  "Operating System :: OS Independent",
@@ -26,6 +22,7 @@ classifiers = [
26
22
  "Topic :: System :: Installation/Setup",
27
23
  "Topic :: Utilities",
28
24
  ]
25
+ dynamic = ["version", "dependencies"]
29
26
 
30
27
  [project.scripts]
31
28
  hwcodecdetect = "HwCodecDetect.run_tests:main"
@@ -33,3 +30,7 @@ hwcodecdetect = "HwCodecDetect.run_tests:main"
33
30
  [project.urls]
34
31
  Homepage = "https://github.com/whyb/HwCodecDetect"
35
32
  Issues = "https://github.com/whyb/HwCodecDetect/issues"
33
+
34
+ [tool.setuptools.dynamic]
35
+ version = {file = ["VERSION"]}
36
+ dependencies = {file = ["requirements.txt"]}
@@ -0,0 +1,2 @@
1
+ colorama
2
+ tqdm
@@ -1,5 +1,9 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
+ def load_requirements(filename="requirements.txt"):
4
+ with open(filename, encoding="utf-8") as f:
5
+ return [line.strip() for line in f if line.strip() and not line.startswith("#")]
6
+
3
7
  with open("README.md", encoding="utf-8") as f:
4
8
  long_description = f.read()
5
9
 
@@ -32,7 +36,7 @@ setup(
32
36
  "Topic :: Utilities",
33
37
  ],
34
38
  python_requires=">=3.8",
35
- install_requires=["colorama", "tqdm"],
39
+ install_requires=load_requirements(),
36
40
  packages=find_packages(where="src"),
37
41
  package_dir={"": "src"},
38
42
  entry_points={
@@ -138,24 +138,48 @@ def install_on_linux():
138
138
  return -1
139
139
 
140
140
  def install_on_macos():
141
- """
142
- Installs FFmpeg using Homebrew for macOS.
143
- """
144
- print("FFmpeg not found. Attempting to install via Homebrew...")
141
+ print("FFmpeg not found. Attempting to install for macOS...")
145
142
 
146
- if not shutil.which("brew"):
147
- print("Homebrew not found. Please install Homebrew first by running:", file=sys.stderr)
148
- print('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"', file=sys.stderr)
149
- return -1
143
+ # Try Homebrew
144
+ if shutil.which("brew"):
145
+ try:
146
+ subprocess.run(["brew", "install", "ffmpeg"], check=True)
147
+ print("FFmpeg installation complete via Homebrew.")
148
+ return 0
149
+ except subprocess.CalledProcessError:
150
+ print("Homebrew installation failed. Trying next method.", file=sys.stderr)
151
+
152
+ # Try MacPorts
153
+ if shutil.which("port"):
154
+ try:
155
+ subprocess.run(["sudo", "port", "install", "ffmpeg"], check=True)
156
+ print("FFmpeg installation complete via MacPorts.")
157
+ return 0
158
+ except subprocess.CalledProcessError:
159
+ print("MacPorts installation failed. Trying next method.", file=sys.stderr)
160
+
161
+ # Try Conda
162
+ if shutil.which("conda"):
163
+ try:
164
+ subprocess.run(["conda", "install", "-c", "conda-forge", "ffmpeg", "-y"], check=True)
165
+ print("FFmpeg installation complete via Conda.")
166
+ return 0
167
+ except subprocess.CalledProcessError:
168
+ print("Conda installation failed. Trying next method.", file=sys.stderr)
169
+
170
+ # Try Nix
171
+ if shutil.which("nix-env"):
172
+ try:
173
+ subprocess.run(["nix-env", "-iA", "nixpkgs.ffmpeg"], check=True)
174
+ print("FFmpeg installation complete via Nix.")
175
+ return 0
176
+ except subprocess.CalledProcessError:
177
+ print("Nix installation failed. Trying next method.", file=sys.stderr)
178
+
179
+ # Manual fallback
180
+ print("All package manager installations failed. Please install FFmpeg manually from https://ffmpeg.org/download.html", file=sys.stderr)
181
+ return -1
150
182
 
151
- try:
152
- print("Attempting to install FFmpeg using brew...")
153
- subprocess.run(["brew", "install", "ffmpeg"], check=True)
154
- print("FFmpeg installation complete.")
155
- return 0
156
- except subprocess.CalledProcessError as e:
157
- print(f"Error installing FFmpeg with Homebrew: {e}", file=sys.stderr)
158
- return -1
159
183
 
160
184
  def get_linux_distro():
161
185
  """
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  import re
3
3
  import sys
4
+ import shlex
4
5
  import subprocess
5
6
  import shutil
6
7
  import tempfile
@@ -182,11 +183,29 @@ def _run_encoder_test_single(test_data):
182
183
  status = "succeeded" if success else "failed"
183
184
 
184
185
  if verbose:
185
- if stdout:
186
- print(f"Output:\n{stdout}")
187
- if stderr:
188
- print(f"Error Output:\n{stderr}")
189
- print(f"Test Result: {status}")
186
+ info_str = f"codec: {codec}, encoder: {encoder}, resolution: {res_size}, status: {status}"
187
+ command_str = " ".join(shlex.quote(arg) for arg in command)
188
+ if stdout.strip() and stderr.strip():
189
+ command_log = f"{stdout.strip()}\n{stderr.strip()}"
190
+ elif stdout.strip():
191
+ command_log = stdout.strip()
192
+ elif stderr.strip():
193
+ command_log = stderr.strip()
194
+ else:
195
+ command_log = "(none)"
196
+ log_message = f"""
197
+ ==================================================
198
+ [Encoder Detect Info]
199
+ {info_str}
200
+
201
+ [FFmpeg Command]
202
+ {command_str}
203
+
204
+ [Command Log]
205
+ {command_log}
206
+
207
+ """.strip()
208
+ print(log_message)
190
209
 
191
210
  title = ENCODER_TITLES.get((encoder, codec), f"{encoder.upper()} Encoder:")
192
211
  return title, res_name, status
@@ -276,11 +295,29 @@ def _run_decoder_test_single(test_data):
276
295
  status = "succeeded" if success else "failed"
277
296
 
278
297
  if verbose:
279
- if stdout:
280
- print(f"Output:\n{stdout}")
281
- if stderr:
282
- print(f"Error Output:\n{stderr}")
283
- print(f"Test Result: {status}")
298
+ info_str = f"codec: {codec}, decoder: {hw_decoder}, resolution: {res_size}, status: {status}"
299
+ command_str = " ".join(shlex.quote(arg) for arg in command)
300
+ if stdout.strip() and stderr.strip():
301
+ command_log = f"{stdout.strip()}\n{stderr.strip()}"
302
+ elif stdout.strip():
303
+ command_log = stdout.strip()
304
+ elif stderr.strip():
305
+ command_log = stderr.strip()
306
+ else:
307
+ command_log = "(none)"
308
+ log_message = f"""
309
+ ==================================================
310
+ [Decoder Detect Info]
311
+ {info_str}
312
+
313
+ [FFmpeg Command]
314
+ {command_str}
315
+
316
+ [Command Log]
317
+ {command_log}
318
+
319
+ """.strip()
320
+ print(log_message)
284
321
 
285
322
  title = DECODER_TITLES.get((hw_decoder, codec), f"{hw_decoder.upper()} Decoder:")
286
323
  return title, res_name, status
@@ -0,0 +1 @@
1
+ __version__ = "0.1.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: HwCodecDetect
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A cross-platform tool to automatically detect and test hardware video decoders/encoders using FFmpeg.
5
5
  Home-page: https://github.com/whyb/HwCodecDetect
6
6
  Author: whyb
@@ -23,7 +23,7 @@ Dynamic: home-page
23
23
  Dynamic: license-file
24
24
  Dynamic: requires-python
25
25
 
26
- # FFmpeg Hardware Codec Test Script(HwCodecDetect)
26
+ # FFmpeg Hardware Codec Detect Script(HwCodecDetect)
27
27
  <p align="center">
28
28
  <a href="https://github.com/whyb/HwCodecDetect/actions/workflows/run-test.yml">
29
29
  <img src="https://github.com/whyb/HwCodecDetect/actions/workflows/run-test.yml/badge.svg" />
@@ -46,7 +46,7 @@ This project was created to solve this very problem. It's a convenient tool for
46
46
 
47
47
  ## Key Features
48
48
  ### Encoders
49
- The script automatically tests and reports on the following major hardware encoders and their supported formats:
49
+ The script automatically detect and reports on the following major hardware encoders and their supported formats:
50
50
  | Encoder Name | Supported Video Formats |
51
51
  |------------------------------------------|------------------------------------------- |
52
52
  | NVEnc | H.264、H.265、AV1 |
@@ -59,7 +59,7 @@ The script automatically tests and reports on the following major hardware encod
59
59
  | Apple VideoToolbox | H.264、H.265 |
60
60
 
61
61
  ### Decoders
62
- The script automatically tests and reports on the following major hardware decoders and their supported formats:
62
+ The script automatically detect and reports on the following major hardware decoders and their supported formats:
63
63
  | Decoder Name | Supported Video Formats |
64
64
  |------------------------------------------ |------------------------------------------------------------- |
65
65
  | NVDec (CUVID) | H.264、H.265、AV1、MJPEG、MPEG-1、MPEG-2、MPEG-4、VP8、VP9 |
@@ -3,6 +3,7 @@ MANIFEST.in
3
3
  README.md
4
4
  VERSION
5
5
  pyproject.toml
6
+ requirements.txt
6
7
  setup.py
7
8
  src/HwCodecDetect/__init__.py
8
9
  src/HwCodecDetect/install_ffmpeg_if_needed.py
@@ -1 +0,0 @@
1
- 0.1.0
@@ -1 +0,0 @@
1
- __version__ = "0.1.0"
File without changes
File without changes
File without changes