PyNvVideoCodec 2.2.1__cp314-cp314-win_arm64.whl

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 (63) hide show
  1. PyNvVideoCodec/PyNvVideoCodec_121.cp314-win_arm64.pyd +0 -0
  2. PyNvVideoCodec/PyNvVideoCodec_130.cp314-win_arm64.pyd +0 -0
  3. PyNvVideoCodec/VersionCheck.cp314-win_arm64.pyd +0 -0
  4. PyNvVideoCodec/__init__.py +251 -0
  5. PyNvVideoCodec/avformat-62.dll +0 -0
  6. PyNvVideoCodec/avutil-60.dll +0 -0
  7. PyNvVideoCodec/decoders/SimpleDecoder.py +273 -0
  8. PyNvVideoCodec/decoders/ThreadedDecoder.py +129 -0
  9. PyNvVideoCodec/decoders/__init__.py +22 -0
  10. PyNvVideoCodec/transcoder/Transcoder.py +55 -0
  11. PyNvVideoCodec/transcoder/__init__.py +22 -0
  12. benchmarks/cached_decoder_benchmark.py +813 -0
  13. benchmarks/frame_sampling_benchmark.py +765 -0
  14. benchmarks/requirements.txt +52 -0
  15. benchmarks/segmented_transcode_benchmark.py +1546 -0
  16. benchmarks/setup_pycuda_win_arm64.bat +531 -0
  17. pynvvideocodec-2.2.1.data/data/external/ffmpeg/readme.txt +39 -0
  18. pynvvideocodec-2.2.1.data/data/external/ffmpeg/src/ffmpeg-8.1.2.tar.xz +0 -0
  19. pynvvideocodec-2.2.1.dist-info/METADATA +97 -0
  20. pynvvideocodec-2.2.1.dist-info/RECORD +63 -0
  21. pynvvideocodec-2.2.1.dist-info/WHEEL +5 -0
  22. pynvvideocodec-2.2.1.dist-info/licenses/LICENSE.txt +22 -0
  23. pynvvideocodec-2.2.1.dist-info/licenses/NOTICES.txt +167 -0
  24. pynvvideocodec-2.2.1.dist-info/top_level.txt +3 -0
  25. samples/advanced/decode.py +173 -0
  26. samples/advanced/decode_from_memory_buffer.py +204 -0
  27. samples/advanced/decode_perf.py +299 -0
  28. samples/advanced/decode_reconfigure.py +184 -0
  29. samples/advanced/decode_sei_msg.py +193 -0
  30. samples/advanced/decode_with_cuda_control.py +214 -0
  31. samples/advanced/decode_with_low_latency.py +183 -0
  32. samples/advanced/encode_config.json +12 -0
  33. samples/advanced/encode_config_lowlatency.json +13 -0
  34. samples/advanced/encode_perf.py +338 -0
  35. samples/advanced/encode_reconfigure.py +211 -0
  36. samples/advanced/encode_sei_msg.py +188 -0
  37. samples/advanced/simple_decode_from_memory.py +151 -0
  38. samples/advanced/simple_decode_stats.py +179 -0
  39. samples/advanced/transcode.py +288 -0
  40. samples/basic/create_video_segments.py +187 -0
  41. samples/basic/encode.py +574 -0
  42. samples/basic/segments.txt +3 -0
  43. samples/basic/simple_decode_sampling.py +182 -0
  44. samples/basic/transcode_config.json +6 -0
  45. samples/jupyter/ReconfigureDecoder.png +0 -0
  46. samples/jupyter/SimpleDecoderAPIs.png +0 -0
  47. samples/jupyter/ThreadedDecoder.png +0 -0
  48. samples/jupyter/coco_classes.pickle +0 -0
  49. samples/jupyter/face_protect_tutorial.ipynb +881 -0
  50. samples/jupyter/object_detection_tutorial.ipynb +781 -0
  51. samples/jupyter/simple_decode_tutorial.ipynb +674 -0
  52. samples/requirements.txt +84 -0
  53. samples/setup_pycuda_win_arm64.bat +531 -0
  54. samples/utils/Utils.py +405 -0
  55. samples/utils/__init__.py +36 -0
  56. samples/utils/decode_parser.py +642 -0
  57. samples/utils/decode_stats_writer.py +177 -0
  58. samples/utils/encode_parallel_utils.py +174 -0
  59. samples/utils/encode_parser.py +379 -0
  60. samples/utils/frame_utils.py +89 -0
  61. samples/utils/sei_message_parser.py +223 -0
  62. samples/utils/sei_parser.py +223 -0
  63. samples/utils/transcode_parser.py +218 -0
@@ -0,0 +1,223 @@
1
+ # This copyright notice applies to this file only
2
+ #
3
+ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4
+ # SPDX-License-Identifier: MIT
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a
7
+ # copy of this software and associated documentation files (the "Software"),
8
+ # to deal in the Software without restriction, including without limitation
9
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ # and/or sell copies of the Software, and to permit persons to whom the
11
+ # Software is furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in
14
+ # all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19
+ # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
+ # DEALINGS IN THE SOFTWARE.
23
+
24
+ """
25
+ SEI message structures and parsing utilities.
26
+ """
27
+
28
+ import ctypes
29
+ import pickle
30
+ import os
31
+ from os.path import join, dirname, abspath
32
+ import PyNvVideoCodec as nvc
33
+
34
+ # Constants
35
+ MAX_CLOCK_TS = 3
36
+
37
+ class TIMECODESET(ctypes.Structure):
38
+ """Structure for time code set information."""
39
+ _fields_ = [
40
+ ("time_offset_value", ctypes.c_uint32), # unsigned int
41
+ ("n_frames", ctypes.c_uint16), # unsigned short
42
+ ("clock_timestamp_flag", ctypes.c_uint8), # unsigned char
43
+ ("units_field_based_flag", ctypes.c_uint8), # unsigned char
44
+ ("counting_type", ctypes.c_uint8), # unsigned char
45
+ ("full_timestamp_flag", ctypes.c_uint8), # unsigned char
46
+ ("discontinuity_flag", ctypes.c_uint8), # unsigned char
47
+ ("cnt_dropped_flag", ctypes.c_uint8), # unsigned char
48
+ ("seconds_value", ctypes.c_uint8), # unsigned char
49
+ ("minutes_value", ctypes.c_uint8), # unsigned char
50
+ ("hours_value", ctypes.c_uint8), # unsigned char
51
+ ("seconds_flag", ctypes.c_uint8), # unsigned char
52
+ ("minutes_flag", ctypes.c_uint8), # unsigned char
53
+ ("hours_flag", ctypes.c_uint8), # unsigned char
54
+ ("time_offset_length", ctypes.c_uint8), # unsigned char
55
+ ("reserved", ctypes.c_uint8), # unsigned char
56
+ ]
57
+
58
+ def __repr__(self):
59
+ return (
60
+ "TIMECODESET(\n"
61
+ f" time_offset_value={self.time_offset_value},\n"
62
+ f" n_frames={self.n_frames},\n"
63
+ f" clock_timestamp_flag={self.clock_timestamp_flag},\n"
64
+ f" units_field_based_flag={self.units_field_based_flag},\n"
65
+ f" counting_type={self.counting_type},\n"
66
+ f" full_timestamp_flag={self.full_timestamp_flag},\n"
67
+ f" discontinuity_flag={self.discontinuity_flag},\n"
68
+ f" cnt_dropped_flag={self.cnt_dropped_flag},\n"
69
+ f" seconds_value={self.seconds_value},\n"
70
+ f" minutes_value={self.minutes_value},\n"
71
+ f" hours_value={self.hours_value},\n"
72
+ f" seconds_flag={self.seconds_flag},\n"
73
+ f" minutes_flag={self.minutes_flag},\n"
74
+ f" hours_flag={self.hours_flag},\n"
75
+ f" time_offset_length={self.time_offset_length},\n"
76
+ f" reserved={self.reserved}\n"
77
+ ")"
78
+ )
79
+
80
+ class TIMECODE(ctypes.Structure):
81
+ """Structure for time code information."""
82
+ _fields_ = [
83
+ ("time_code_set", TIMECODESET * MAX_CLOCK_TS), # Array of TIMECODESET
84
+ ("num_clock_ts", ctypes.c_uint8), # unsigned char
85
+ ]
86
+
87
+ def __repr__(self):
88
+ time_code_set_repr = ",\n ".join(
89
+ repr(self.time_code_set[i]) for i in range(self.num_clock_ts)
90
+ )
91
+ return (
92
+ "TIMECODE(\n"
93
+ f" time_code_set=[\n {time_code_set_repr}\n ],\n"
94
+ f" num_clock_ts={self.num_clock_ts}\n"
95
+ ")"
96
+ )
97
+
98
+ class SEICONTENTLIGHTLEVELINFO(ctypes.Structure):
99
+ """Structure for content light level information."""
100
+ _fields_ = [
101
+ ("max_content_light_level", ctypes.c_uint16), # unsigned short
102
+ ("max_pic_average_light_level", ctypes.c_uint16), # unsigned short
103
+ ("reserved", ctypes.c_uint32), # unsigned int
104
+ ]
105
+
106
+ def __repr__(self):
107
+ return (
108
+ "SEICONTENTLIGHTLEVELINFO(\n"
109
+ f" max_content_light_level={self.max_content_light_level},\n"
110
+ f" max_pic_average_light_level={self.max_pic_average_light_level},\n"
111
+ f" reserved={self.reserved}\n"
112
+ ")"
113
+ )
114
+
115
+ class SEIMASTERINGDISPLAYINFO(ctypes.Structure):
116
+ """Structure for mastering display information."""
117
+ _fields_ = [
118
+ ("display_primaries_x", ctypes.c_uint16 * 3), # Array of 3 unsigned short
119
+ ("display_primaries_y", ctypes.c_uint16 * 3), # Array of 3 unsigned short
120
+ ("white_point_x", ctypes.c_uint16), # unsigned short
121
+ ("white_point_y", ctypes.c_uint16), # unsigned short
122
+ ("max_display_mastering_luminance", ctypes.c_uint32), # unsigned int
123
+ ("min_display_mastering_luminance", ctypes.c_uint32), # unsigned int
124
+ ]
125
+
126
+ def __repr__(self):
127
+ return (
128
+ "SEIMASTERINGDISPLAYINFO(\n"
129
+ f" display_primaries_x={list(self.display_primaries_x)},\n"
130
+ f" display_primaries_y={list(self.display_primaries_y)},\n"
131
+ f" white_point_x={self.white_point_x},\n"
132
+ f" white_point_y={self.white_point_y},\n"
133
+ f" max_display_mastering_luminance={self.max_display_mastering_luminance},\n"
134
+ f" min_display_mastering_luminance={self.min_display_mastering_luminance}\n"
135
+ ")"
136
+ )
137
+
138
+ class TIMECODEMPEG2(ctypes.Structure):
139
+ """Structure for MPEG2 time code information."""
140
+ _fields_ = [
141
+ ("drop_frame_flag", ctypes.c_uint8), # unsigned char
142
+ ("time_code_hours", ctypes.c_uint8), # unsigned char
143
+ ("time_code_minutes", ctypes.c_uint8), # unsigned char
144
+ ("marker_bit", ctypes.c_uint8), # unsigned char
145
+ ("time_code_seconds", ctypes.c_uint8), # unsigned char
146
+ ("time_code_pictures", ctypes.c_uint8), # unsigned char
147
+ ]
148
+
149
+ def __repr__(self):
150
+ return (
151
+ "TIMECODEMPEG2(\n"
152
+ f" drop_frame_flag={self.drop_frame_flag},\n"
153
+ f" time_code_hours={self.time_code_hours},\n"
154
+ f" time_code_minutes={self.time_code_minutes},\n"
155
+ f" marker_bit={self.marker_bit},\n"
156
+ f" time_code_seconds={self.time_code_seconds},\n"
157
+ f" time_code_pictures={self.time_code_pictures}\n"
158
+ ")"
159
+ )
160
+
161
+ class SEIALTERNATIVETRANSFERCHARACTERISTICS(ctypes.Structure):
162
+ """Structure for alternative transfer characteristics."""
163
+ _fields_ = [
164
+ ("preferred_transfer_characteristics", ctypes.c_uint8), # unsigned char
165
+ ]
166
+
167
+ def __repr__(self):
168
+ return f"SEIALTERNATIVETRANSFERCHARACTERISTICS(preferred_transfer_characteristics={self.preferred_transfer_characteristics})"
169
+
170
+ def write_sei_messages(sei_messages, sei_file_path, script_dir=None):
171
+ """
172
+ Write SEI messages to output files.
173
+
174
+ This function writes SEI messages in three formats:
175
+ 1. sei_message.bin - Raw binary SEI messages
176
+ 2. sei_type_message.bin - Pickled SEI type information
177
+ 3. sei_message.txt - Human-readable parsed SEI content
178
+
179
+ Parameters:
180
+ sei_messages (list): List of tuples containing (sei_info, sei_message)
181
+ sei_file_path (str): Path to output file (base name for all three files)
182
+ script_dir (str, optional): Directory for type message file. If None, uses sei_file_path's directory.
183
+
184
+ Returns:
185
+ None
186
+ """
187
+ # Determine output paths
188
+ if script_dir is None:
189
+ script_dir = dirname(abspath(sei_file_path))
190
+
191
+ sei_type_message_path = join(script_dir, "sei_type_message.bin")
192
+
193
+ # Open files for storing SEI data
194
+ with open(sei_file_path, "wb") as file_message, \
195
+ open(sei_type_message_path, "wb") as file_type_message:
196
+
197
+ for sei_info, sei_message in sei_messages:
198
+ sei_type = sei_info["sei_type"]
199
+ sei_uncompressed = sei_info["sei_uncompressed"]
200
+
201
+ if sei_uncompressed == 1:
202
+ buffer = (ctypes.c_ubyte * len(sei_message))(*sei_message)
203
+ sei_struct = None
204
+
205
+ # Handle different SEI message types
206
+ if sei_type in (nvc.SEI_TYPE.TIME_CODE_H264, nvc.SEI_TYPE.TIME_CODE):
207
+ sei_struct = ctypes.cast(
208
+ buffer,
209
+ ctypes.POINTER(TIMECODEMPEG2 if codec_id == nvc.cudaVideoCodec.MPEG2 else TIMECODE)
210
+ ).contents
211
+ elif sei_type == nvc.SEI_TYPE.MASTERING_DISPLAY_COLOR_VOLUME:
212
+ sei_struct = ctypes.cast(buffer, ctypes.POINTER(SEIMASTERINGDISPLAYINFO)).contents
213
+ elif sei_type == nvc.SEI_TYPE.CONTENT_LIGHT_LEVEL_INFO:
214
+ sei_struct = ctypes.cast(buffer, ctypes.POINTER(SEICONTENTLIGHTLEVELINFO)).contents
215
+ elif sei_type == nvc.SEI_TYPE.ALTERNATIVE_TRANSFER_CHARACTERISTICS:
216
+ sei_struct = ctypes.cast(buffer, ctypes.POINTER(SEIALTERNATIVETRANSFERCHARACTERISTICS)).contents
217
+
218
+ if sei_struct:
219
+ print(sei_struct)
220
+
221
+ file_message.write(bytearray(sei_message))
222
+ pickle.dump(sei_messages, file_type_message)
223
+ print(f"SEI message written to {sei_file_path}")
@@ -0,0 +1,218 @@
1
+ # This copyright notice applies to this file only
2
+ #
3
+ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4
+ # SPDX-License-Identifier: MIT
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a
7
+ # copy of this software and associated documentation files (the "Software"),
8
+ # to deal in the Software without restriction, including without limitation
9
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ # and/or sell copies of the Software, and to permit persons to whom the
11
+ # Software is furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in
14
+ # all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19
+ # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
+ # DEALINGS IN THE SOFTWARE.
23
+
24
+ """
25
+ Argument parsing utilities for transcoding applications.
26
+
27
+ Two parser families live here, one per transcode sample:
28
+
29
+ add_transcode_args / parse_transcode_args
30
+ Segment-transcode CLI used by samples/basic/create_video_segments.py.
31
+ Exposes -i, -s (segments file), -c (config file), -o (output
32
+ template), -g. Do not change without auditing that sample.
33
+
34
+ add_advanced_transcode_args / load_advanced_transcode_config /
35
+ parse_advanced_transcode_args
36
+ Full-pipeline transcode CLI used by samples/advanced/transcode.py.
37
+ Exposes -i, -o, -c (codec), -g, -fps, -json, --dump, --bframes.
38
+ load_advanced_transcode_config(args) returns a dict of encoder
39
+ kwargs ready to splat into nvc.CreateEncoder().
40
+ """
41
+
42
+ import argparse
43
+ import json
44
+ import os
45
+ from pathlib import Path
46
+ from os.path import join, dirname, abspath
47
+
48
+ def add_transcode_args(parser):
49
+ """Add transcoding-specific arguments to an argument parser.
50
+
51
+ Args:
52
+ parser (argparse.ArgumentParser): The parser to add arguments to
53
+
54
+ Returns:
55
+ None
56
+ """
57
+ parser.add_argument("-i", "--input_file_path", required=True, type=str,
58
+ help="Path to input video file")
59
+
60
+ parser.add_argument("-s", "--segments_file_path", type=str,
61
+ default=join(dirname(dirname(__file__)),"basic", "segments.txt"),
62
+ help="Path to segments file (format: 'start_time end_time' per line)")
63
+
64
+ parser.add_argument("-c", "--config_file_path", type=str,
65
+ default=join(dirname(dirname(__file__)),"basic", "transcode_config.json"),
66
+ help="Path to transcoder config JSON file")
67
+
68
+ parser.add_argument("-o", "--output_template", type=str,
69
+ default="{input_file_name}_segment",
70
+ help="Output filename template")
71
+
72
+ parser.add_argument("-g", "--gpu_id", type=int, default=0,
73
+ help="GPU ID to use (default: 0)")
74
+
75
+ def parse_transcode_args(description):
76
+ """Parse command line arguments for transcoding applications.
77
+
78
+ Args:
79
+ description (str): Description of the application
80
+
81
+ Returns:
82
+ argparse.Namespace: Parsed arguments
83
+ """
84
+ parser = argparse.ArgumentParser(description=description)
85
+ add_transcode_args(parser)
86
+ return parser.parse_args()
87
+
88
+
89
+ def add_advanced_transcode_args(parser):
90
+ """Add CLI arguments for the full-pipeline transcoder.
91
+
92
+ Mirrors the historical CLI of samples/advanced/transcode.py exactly,
93
+ so existing user invocations keep working. Distinct from
94
+ add_transcode_args() above, which targets the segment-transcode
95
+ sample (samples/basic/create_video_segments.py) and exposes a
96
+ different set of flags.
97
+
98
+ Args:
99
+ parser (argparse.ArgumentParser): The parser to add arguments to.
100
+ """
101
+ parser.add_argument(
102
+ "-i", "--input",
103
+ type=Path,
104
+ required=True,
105
+ help="Input video file (container or elementary bitstream).",
106
+ )
107
+ parser.add_argument(
108
+ "-o", "--output",
109
+ type=Path,
110
+ required=True,
111
+ help="Output video file. A container extension (.mp4, .mov, .mkv, "
112
+ ".webm, .avi) triggers muxing of both video and audio.",
113
+ )
114
+ parser.add_argument(
115
+ "-c", "--codec",
116
+ type=str,
117
+ default=None,
118
+ choices=["H264", "HEVC", "AV1"],
119
+ help="Output codec; if not specified, uses the input codec.",
120
+ )
121
+ parser.add_argument(
122
+ "-g", "--gpu_id",
123
+ type=int,
124
+ default=0,
125
+ help="GPU ID to use. Default: 0.",
126
+ )
127
+ parser.add_argument(
128
+ "-fps", "--fps",
129
+ type=int,
130
+ default=0,
131
+ help="Output FPS override; only honoured for elementary-bitstream "
132
+ "input (containers carry their own FPS in metadata, which "
133
+ "always wins). Default: 0 (auto from input).",
134
+ )
135
+ parser.add_argument(
136
+ "-json", "--config",
137
+ type=Path,
138
+ default=None,
139
+ help="Encoder configuration JSON file. Default: encode_config.json "
140
+ "next to the transcode sample.",
141
+ )
142
+ parser.add_argument(
143
+ "--dump",
144
+ action="store_true",
145
+ help="Dump decoded YUV frames + encoded bitstream to "
146
+ "<output_stem>_decoded.yuv / <output_stem>_encoded.<ext>.",
147
+ )
148
+ parser.add_argument(
149
+ "--bframes",
150
+ type=int,
151
+ default=None,
152
+ metavar="N",
153
+ help="Override encoder B-frame count (encoder key 'bf'). If "
154
+ "omitted, the JSON config / encoder default applies.",
155
+ )
156
+
157
+
158
+ def load_advanced_transcode_config(args):
159
+ """Build the encoder config dict for the full-pipeline transcoder.
160
+
161
+ Loads the JSON config file (default: samples/advanced/encode_config.json),
162
+ upper-cases the preset, and applies the CLI overrides:
163
+
164
+ * --codec -> config["codec"] (lower-case)
165
+ * --bframes N -> config["bf"] (string, clamped >= 0)
166
+ * --fps N -> config["fps"] (string, only when N > 0;
167
+ ignored by the encoder when a
168
+ source AVFormatContext is also
169
+ provided -- ExtractSourceFrameRate
170
+ in NvEncoderClInterface always
171
+ wins for container inputs).
172
+
173
+ Args:
174
+ args (argparse.Namespace): Output of parse_advanced_transcode_args.
175
+
176
+ Returns:
177
+ dict: kwargs ready to splat into nvc.CreateEncoder().
178
+ """
179
+ config = {}
180
+ config_path = args.config or Path(
181
+ join(dirname(dirname(abspath(__file__))), "advanced", "encode_config.json")
182
+ )
183
+ if config_path.exists():
184
+ with open(config_path) as f:
185
+ config = json.load(f)
186
+ if "preset" in config:
187
+ config["preset"] = config["preset"].upper()
188
+ if args.codec is not None:
189
+ config["codec"] = args.codec.lower()
190
+ if args.bframes is not None:
191
+ config["bf"] = str(max(0, int(args.bframes)))
192
+ if args.fps and args.fps > 0:
193
+ config["fps"] = str(int(args.fps))
194
+ return config
195
+
196
+
197
+ def parse_advanced_transcode_args(description=None):
198
+ """Parse + load config for the full-pipeline transcoder.
199
+
200
+ Returns the argparse.Namespace with one extra attribute:
201
+
202
+ * args.config -- dict of encoder kwargs (JSON + CLI overrides),
203
+ ready to splat into nvc.CreateEncoder().
204
+
205
+ Distinct from parse_transcode_args() above, which targets the
206
+ segment-transcode sample (samples/basic/create_video_segments.py).
207
+
208
+ Args:
209
+ description (str | None): argparse description string.
210
+
211
+ Returns:
212
+ argparse.Namespace
213
+ """
214
+ parser = argparse.ArgumentParser(description=description)
215
+ add_advanced_transcode_args(parser)
216
+ args = parser.parse_args()
217
+ args.config = load_advanced_transcode_config(args)
218
+ return args