PyNvVideoCodec 2.0.4__cp314-cp314-win_amd64.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 (65) hide show
  1. PyNvVideoCodec/PyNvVideoCodec_121.cp314-win_amd64.pyd +0 -0
  2. PyNvVideoCodec/PyNvVideoCodec_130.cp314-win_amd64.pyd +0 -0
  3. PyNvVideoCodec/VersionCheck.cp314-win_amd64.pyd +0 -0
  4. PyNvVideoCodec/__init__.py +246 -0
  5. PyNvVideoCodec/avcodec-62.dll +0 -0
  6. PyNvVideoCodec/avdevice-62.dll +0 -0
  7. PyNvVideoCodec/avfilter-11.dll +0 -0
  8. PyNvVideoCodec/avformat-62.dll +0 -0
  9. PyNvVideoCodec/avutil-60.dll +0 -0
  10. PyNvVideoCodec/decoders/SimpleDecoder.py +230 -0
  11. PyNvVideoCodec/decoders/ThreadedDecoder.py +129 -0
  12. PyNvVideoCodec/decoders/__init__.py +22 -0
  13. PyNvVideoCodec/swresample-6.dll +0 -0
  14. PyNvVideoCodec/swscale-9.dll +0 -0
  15. PyNvVideoCodec/transcoder/Transcoder.py +55 -0
  16. PyNvVideoCodec/transcoder/__init__.py +22 -0
  17. benchmarks/cached_decoder_benchmark.py +813 -0
  18. benchmarks/frame_sampling_benchmark.py +765 -0
  19. benchmarks/requirements.txt +47 -0
  20. benchmarks/segmented_transcode_benchmark.py +1546 -0
  21. pynvvideocodec-2.0.4.data/data/external/ffmpeg/readme.txt +15 -0
  22. pynvvideocodec-2.0.4.data/data/external/ffmpeg/src/ffmpeg-8.1.1.tar.xz +0 -0
  23. pynvvideocodec-2.0.4.dist-info/METADATA +84 -0
  24. pynvvideocodec-2.0.4.dist-info/RECORD +65 -0
  25. pynvvideocodec-2.0.4.dist-info/WHEEL +5 -0
  26. pynvvideocodec-2.0.4.dist-info/licenses/LICENSE.txt +22 -0
  27. pynvvideocodec-2.0.4.dist-info/licenses/NOTICES.txt +167 -0
  28. pynvvideocodec-2.0.4.dist-info/top_level.txt +3 -0
  29. samples/advanced/decode.py +173 -0
  30. samples/advanced/decode_from_memory_buffer.py +204 -0
  31. samples/advanced/decode_perf.py +299 -0
  32. samples/advanced/decode_reconfigure.py +184 -0
  33. samples/advanced/decode_sei_msg.py +193 -0
  34. samples/advanced/decode_with_cuda_control.py +214 -0
  35. samples/advanced/decode_with_low_latency.py +183 -0
  36. samples/advanced/encode_config.json +9 -0
  37. samples/advanced/encode_config_lowlatency.json +11 -0
  38. samples/advanced/encode_perf.py +338 -0
  39. samples/advanced/encode_reconfigure.py +211 -0
  40. samples/advanced/encode_sei_msg.py +188 -0
  41. samples/advanced/simple_decode_stats.py +179 -0
  42. samples/advanced/transcode.py +288 -0
  43. samples/basic/create_video_segments.py +187 -0
  44. samples/basic/encode.py +347 -0
  45. samples/basic/encode_config.json +9 -0
  46. samples/basic/segments.txt +3 -0
  47. samples/basic/simple_decode_sampling.py +182 -0
  48. samples/basic/transcode_config.json +6 -0
  49. samples/jupyter/ReconfigureDecoder.png +0 -0
  50. samples/jupyter/SimpleDecoderAPIs.png +0 -0
  51. samples/jupyter/ThreadedDecoder.png +0 -0
  52. samples/jupyter/coco_classes.pickle +0 -0
  53. samples/jupyter/object_detection_tutorial.ipynb +762 -0
  54. samples/jupyter/simple_decode_tutorial.ipynb +651 -0
  55. samples/requirements.txt +78 -0
  56. samples/utils/Utils.py +405 -0
  57. samples/utils/__init__.py +36 -0
  58. samples/utils/decode_parser.py +642 -0
  59. samples/utils/decode_stats_writer.py +177 -0
  60. samples/utils/encode_parallel_utils.py +174 -0
  61. samples/utils/encode_parser.py +357 -0
  62. samples/utils/frame_utils.py +89 -0
  63. samples/utils/sei_message_parser.py +223 -0
  64. samples/utils/sei_parser.py +223 -0
  65. samples/utils/transcode_parser.py +218 -0
@@ -0,0 +1,15 @@
1
+ FFMPEG Libraries present in this package were built using the following configure options
2
+
3
+ x64 (FFmpeg 8.1.1): ./configure --toolchain=msvc --enable-shared --disable-static --disable-encoders --disable-decoders --enable-decoder=vp9 --disable-programs --disable-doc --disable-network
4
+ win32: ./configure --enable-shared --disable-encoders --disable-decoders --enable-decoder=vp9 --toolchain=msvc --arch=x86
5
+ x86_64: LDSOFLAGS=-Wl,-rpath,\''$$$$ORIGIN'\' ./configure --enable-shared --disable-encoders --disable-decoders --enable-decoder=vp9 --arch=x86_64
6
+ aarch64: LDSOFLAGS=-Wl,-rpath,\''$$$$ORIGIN'\' ./configure --enable-shared --disable-encoders --disable-decoders --enable-decoder=vp9 --arch=aarch64
7
+
8
+ Notes:
9
+ - --disable-postproc was removed as a configure option in FFmpeg 8.x and is no longer passed for the x64 build.
10
+ - The x64 build uses the canonical install layout: import .lib files and DLLs co-located in lib/x64/; matching headers in include/lib*.
11
+
12
+ Only header files and libraries that are required for compiling the sample applications inside the package have been included.
13
+
14
+
15
+
@@ -0,0 +1,84 @@
1
+ Metadata-Version: 2.4
2
+ Name: pynvvideocodec
3
+ Version: 2.0.4
4
+ Summary: pynvvideocodec (PyNvVideoCodec) is NVIDIA's Python library for hardware-accelerated video encode/decode on NVIDIA GPUs.
5
+ Author: NVIDIA
6
+ Maintainer: nvidia
7
+ License: MIT
8
+ Project-URL: documentation, https://docs.nvidia.com/video-technologies/pynvvideocodec/index.html
9
+ Project-URL: source, https://catalog.ngc.nvidia.com/orgs/nvidia/resources/pynvvideocodec
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE.txt
14
+ License-File: NOTICES.txt
15
+ Dynamic: license-file
16
+
17
+ # **PyNvVideoCodec**
18
+
19
+ [PyNvVideoCodec](https://docs.nvidia.com/video-technologies/pynvvideocodec/index.html) is NVIDIA's Python-based library that provides simple yet powerful Python APIs for hardware-accelerated video encoding and decoding on NVIDIA GPUs.
20
+
21
+ PyNvVideoCodec is built on top of the Video Codec SDK and offers encode, decode, and transcode performance on par with it.
22
+
23
+ The library is distributed under MIT license and is officially supported by NVIDIA.
24
+
25
+ This release introduces several new features and enhancements designed to optimize video processing workflows in AI and multimedia applications.
26
+
27
+ ## **Release Notes (2.0.4)**
28
+
29
+ * Fixed wheel packaging by removing stale FFmpeg 4.4 libraries.
30
+ * Upgraded bundled FFmpeg from 7.0.2 to 8.1.1.
31
+
32
+
33
+ ## **Features (2.0 and above)**
34
+
35
+ Current PyNvVideoCodec version supports following features:
36
+
37
+ ### **Decode Features**
38
+
39
+ * **Seek and frame sampling:** Provides efficient and flexible methods for fetching video frames in various modes, including sequential, random, periodic, indexed, batched, and sliced, as well as at a specified target frame rate.
40
+ * **Decoder caching:** Optimizes decoding of short video clips through decoder caching and reconfiguration.
41
+ * **Threaded decoder:** Supports decoding on separate threads, delivering pre-decoded frames with near-zero latency, enabling high-performance video processing pipelines.
42
+ * **Video processing from buffer:** Supports video processing from memory buffers, reducing I/O overhead, enabling streaming applications.
43
+ * **Low latency decode:** Offers zero-latency decoding for video sequences that do not contain B-frames.
44
+ * **SEI extraction:** Supports the extraction of Supplemental Enhancement Information (SEI) messages, allowing access to additional information such as HDR information, timecodes, and custom user data.
45
+ * **Stream metadata access:** Enables access to stream metadata, including frame width, height, bit depth, and keyframe indices, to enhance content management.
46
+ * **GIL handling:** Improved multithreaded performance through better handling of Global Interpreter Lock (GIL) in C++ layer.
47
+ * **Multi-GPU decode:** Enables multi-GPU decoding to efficiently handle larger workloads.
48
+ * **Extended codec support:** Supports codecs H.264, HEVC, AV1, VP8, VP9, VC1, MPEG4, MPEG2, and MPEG1
49
+ * **4:2:2 decode:** Supports 4:2:2 decoding for both H.264 and HEVC formats on Blackwell GPUs (NV16, P210 and P216 surface formats).
50
+ * **Extended output formats :** Decode to various output formats including NV12, YUV420, YUV444, NV16, P010, P016 and RGB24(interleaved and planar)
51
+
52
+
53
+
54
+ ### **Encode Features**
55
+
56
+ * **Encoder reconfiguration:** Supports encoder reconfiguration, enabling dynamic updating of encoding parameters without recreating encoder instances.
57
+ * **SEI insertion:** Allows insertion of SEI messages during encoding.
58
+ * **GIL handling:** Improved multithreaded performance through better handling of Global Interpreter Lock (GIL) in C++ layer.
59
+ * **Multi-GPU encode:** Enables multi-GPU encoding to efficiently handle larger workloads.
60
+ * **Codec support:** Support encoding to codec H.264, HEVC, and AV1.
61
+ * **4:2:2 encode:** Supports 4:2:2 encoding for both H.264 and HEVC formats on Blackwell GPUs (NV16 and P210 surface formats).
62
+ * **Extended input formats:** Encode from various input formats including NV12, YV12, IYUV, YUV444, YUV420\_10BIT, YUV444\_10BIT, NV16, P210, ARGB, ABGR, ARGB10, and ABGR10.
63
+
64
+
65
+
66
+ ### **Transcode Features**
67
+
68
+ * **Segment-based transcode:** Enables transcoding of video segments based on timestamp ranges, ideal for content editing and partial processing.
69
+
70
+ ## **Distribution**
71
+
72
+ PyNvVideoCodec library is distributed in two formats: binary distribution via [PyPI](https://pypi.org/project/pynvvideocodec/) and source code distribution via [NVIDIA NGC](https://catalog.ngc.nvidia.com/orgs/nvidia/resources/pynvvideocodec). In both cases, the library and its dependencies can be installed using a single pip install command.
73
+
74
+ This package on PyPI contains Python WHLs of the PyNvVideoCodec library and sample applications that demonstrate the use of the PyNvVideoCodec API. To install these please open the shell prompt, and run the following command.
75
+
76
+ ```py
77
+ $ pip install PyNvVideoCodec
78
+ ```
79
+
80
+ ## **Sample Applications and Documents**
81
+
82
+ * A package containing PyNvVideoCodec source code, Python sample applications and documentation can be downloaded from [NVIDIA NGC](https://catalog.ngc.nvidia.com/orgs/nvidia/resources/pynvvideocodec).
83
+ * For your convenience, the documents are also accessible online at [PyNvVideoCodec Online Documentation](https://docs.nvidia.com/video-technologies/pynvvideocodec/index.html).
84
+
@@ -0,0 +1,65 @@
1
+ PyNvVideoCodec/PyNvVideoCodec_121.cp314-win_amd64.pyd,sha256=oWd8rteGe3R1RtsvNN4F1pqc7P3Bc-8rzMYTiNro1NE,2010624
2
+ PyNvVideoCodec/PyNvVideoCodec_130.cp314-win_amd64.pyd,sha256=6awYeXSieSJeRYH4yK3I7N77I0d5lQieBB5Vsh1REIo,2016256
3
+ PyNvVideoCodec/VersionCheck.cp314-win_amd64.pyd,sha256=hxP3ZhHsIkn2WsS8HL0R1LJ-UuAcKJJAFOj0TinU1CY,148992
4
+ PyNvVideoCodec/__init__.py,sha256=XzvmM1fS2OKWyzOpAFg5Uy0sqBWKoviPz8IAVmqqhKg,10184
5
+ PyNvVideoCodec/avcodec-62.dll,sha256=b4z1UgKJrkgNW6RJxqvtytGgB1sjkxCJJdMQETyfzOI,8904192
6
+ PyNvVideoCodec/avdevice-62.dll,sha256=7A7CVBdqGtXoP7yT7s-qZRyNkgH9cAvUCec8qQ9I2Hs,924160
7
+ PyNvVideoCodec/avfilter-11.dll,sha256=LLUPQrVgS5-zmBYVClM6RS_AlAhyzEPyBqDj-R6SSNw,7796736
8
+ PyNvVideoCodec/avformat-62.dll,sha256=_dBwmYbNXuZTpZdYZBKAccP3Izu_jfe-5T0t5I8m-pQ,3988480
9
+ PyNvVideoCodec/avutil-60.dll,sha256=IkcNBETt-zx--u0qZVLwbMZ7idmo4DCgH98sBuMz0aQ,2154496
10
+ PyNvVideoCodec/swresample-6.dll,sha256=7f8pD_45ST3A9gLOzrmLSxXWlNZog0NA8jWvBwQmN_s,806400
11
+ PyNvVideoCodec/swscale-9.dll,sha256=EUAI8Th82uaKgoX4cTAFgrFq3XOoH6IuxY05cVP85tA,2176000
12
+ PyNvVideoCodec/decoders/SimpleDecoder.py,sha256=8tepHrE3YNg8i-Re9SvrffF1psYCECPibm7f_ZLiqI8,10121
13
+ PyNvVideoCodec/decoders/ThreadedDecoder.py,sha256=KeQj3IDL03Yc3-MnoO2EsFIfzXTNRfRo7h3U46tLoi0,6805
14
+ PyNvVideoCodec/decoders/__init__.py,sha256=opQYWVM7fVcCedCrl6J_3eWGbKN4q55ffvnJKgwq6co,1259
15
+ PyNvVideoCodec/transcoder/Transcoder.py,sha256=0Pc81-paVtxZwArHb2FJ9luhD2WYgLoiL_cQw515pFA,2443
16
+ PyNvVideoCodec/transcoder/__init__.py,sha256=2nkwMgry3-aPl_MNzdh6wCDR9bGJWzUzN9mHgbqX6Uk,1261
17
+ benchmarks/cached_decoder_benchmark.py,sha256=Bu3O7G_fGudgxs5ZLrjYYdpQlppaoHBOi-d_kEEXNLA,33544
18
+ benchmarks/frame_sampling_benchmark.py,sha256=PdkUKeG1uwMkkhULnQChQA_V3U2jNRtuXEt7cdr14Ek,33583
19
+ benchmarks/requirements.txt,sha256=fRjkAmV52t_q5tH5Bqa8nvxtRBr8N0fhjwJqMlZ3Jww,1916
20
+ benchmarks/segmented_transcode_benchmark.py,sha256=ehVPbylTvnwCiddDkrTl0lBNo8dg-cj7pSrUYrspdH4,68582
21
+ pynvvideocodec-2.0.4.data/data/external/ffmpeg/readme.txt,sha256=b3A6UOXOXAr4tRvlmmEatd_b2QDod6_CDXXHchXdjGM,1109
22
+ pynvvideocodec-2.0.4.data/data/external/ffmpeg/src/ffmpeg-8.1.1.tar.xz,sha256=toY63emImPQmAgF0YocbX2Mz5lrsgD_demMIY5xS7fM,11709440
23
+ pynvvideocodec-2.0.4.dist-info/licenses/LICENSE.txt,sha256=2zbykdcROaQUD-lZ0yCXhia2szvXi5rnNgA-JV1hP4o,1174
24
+ pynvvideocodec-2.0.4.dist-info/licenses/NOTICES.txt,sha256=YO5BKdOKsY_HJTtamtqg6o7RoHOzl87HY2zsCUdICdk,7886
25
+ samples/requirements.txt,sha256=xbSObJFb7kn_GMUbSYvUM61da_GBuZqvgj-SF3RR5co,3053
26
+ samples/advanced/decode.py,sha256=diX6orPXRWT4jz0tgIhGHzvMgcB8cKm1Pdo8PsX96I8,7720
27
+ samples/advanced/decode_from_memory_buffer.py,sha256=cmQBQ63L3wQpYQagrF4XSIpiPyL_hsr8ZZdbIRANM7g,7811
28
+ samples/advanced/decode_perf.py,sha256=KkNbQ8DziAWWZEpWDWcoUGxOJZsJTeUxdNbCeId9ZdI,12267
29
+ samples/advanced/decode_reconfigure.py,sha256=dmy7k_Aq8Ke9Ok0Uwu-RYeuHVywrK9MbGgVzxaRT8HY,8309
30
+ samples/advanced/decode_sei_msg.py,sha256=xWR-_yRCb4LbQvKAfkD18YBldUrkZo8gloq4Yz9Rllc,8257
31
+ samples/advanced/decode_with_cuda_control.py,sha256=G9PQcjUl4wRLt4lB0F-vf3b9Ic1oh0sG4iVNTS77Zoo,9258
32
+ samples/advanced/decode_with_low_latency.py,sha256=mqMRQI29yLzRJ8CBL38Xc9enSG3hBAhSCiByCuZ7y1g,8292
33
+ samples/advanced/encode_config.json,sha256=cImWuZDTVi6oaQG_WeAFfKUmF68zUPLHQf4idU3xYG4,185
34
+ samples/advanced/encode_config_lowlatency.json,sha256=C9aUfpMrarRjovVJIfKA-58fWwUtMs9bWhrgGNAWClc,199
35
+ samples/advanced/encode_perf.py,sha256=EpDqluG-A8mzXQ9gw85QonuuhJGnkjP8JUd-tPT2XLY,13197
36
+ samples/advanced/encode_reconfigure.py,sha256=aPukLDvx9XKTpAmRFDJ2VYGQcYak7O6PcWZqjBi1VhU,8648
37
+ samples/advanced/encode_sei_msg.py,sha256=aOhrPjXuwAE8xgUi4hXf27RoJQsnZDEx-rZRNWISTz8,7965
38
+ samples/advanced/simple_decode_stats.py,sha256=wt3HADZGAbWuAmmezFMCgljqRQiaA6XsVDy9sZL_Cu4,7171
39
+ samples/advanced/transcode.py,sha256=NnMRNp8ROgf_mF2BnD7Ei8ZBpCpXF5lcj3FiAj6veFw,11548
40
+ samples/basic/create_video_segments.py,sha256=COthhME8KfHGJhL_rGpdKkjS-HzjvRHxtrOn5L8z5bs,7631
41
+ samples/basic/encode.py,sha256=vY3vzcFDTrJQXBY5x2tYB9q2hO6-Ip6kqh6i42hosl8,13777
42
+ samples/basic/encode_config.json,sha256=cImWuZDTVi6oaQG_WeAFfKUmF68zUPLHQf4idU3xYG4,185
43
+ samples/basic/segments.txt,sha256=URKw_1BeqiMV2vYaPc213Z1YnUbnyYPzCONRJ5qAXmU,17
44
+ samples/basic/simple_decode_sampling.py,sha256=oj7Ve9jNWTJQYN-U3ZelP6KvSknz4INE0Yw9SUNvBmI,6990
45
+ samples/basic/transcode_config.json,sha256=mSnYYW5KOVlMC6pmG3guLtAqBn1PQzcLXPy2Gl7vObU,102
46
+ samples/jupyter/ReconfigureDecoder.png,sha256=DsEFxg0RBPucx_Ky_HaZ5iE21TJ-aTQlOMAOenIHDco,114179
47
+ samples/jupyter/SimpleDecoderAPIs.png,sha256=uJM1EAI1xg6Om0PCP6joLo1W4i0A0Xp9YUqTuEgq2ic,54815
48
+ samples/jupyter/ThreadedDecoder.png,sha256=Ts4MpymKaKjNJlSQdlzeO_uBxce5_aZe14_VlZKqSvU,98415
49
+ samples/jupyter/coco_classes.pickle,sha256=kkzIHUQ4Xz8CDISRbPmClEqM86WeV9i16SCs-vYM-jg,838
50
+ samples/jupyter/object_detection_tutorial.ipynb,sha256=OE3wdOLFKo_3vyxktApX3EZ2OHEYBfOKsiZ70C4tjso,390849
51
+ samples/jupyter/simple_decode_tutorial.ipynb,sha256=7iXSofLEG2Ye1IE4HuoZj-tLUVdik_1wh69B2ssgZJE,5285355
52
+ samples/utils/Utils.py,sha256=yeMrz4BSg_P4Xzt9jx7m7cRzMnNKqp9GGhRXPRtgo0A,17773
53
+ samples/utils/__init__.py,sha256=w8rVqKtCUkDPxAyGvUn33Pij74bSkbGIthq13OsKVZs,1915
54
+ samples/utils/decode_parser.py,sha256=QDZmbYvaBfn7oozvQHnAC93F1Qy8jTtpkdDgmgv5cmI,25347
55
+ samples/utils/decode_stats_writer.py,sha256=HZe2J6MBgbeg_rjZHFf_Y3naEU4Qc7S7Gz_hkHikal0,7996
56
+ samples/utils/encode_parallel_utils.py,sha256=Y4rHnZAEkdE_MilRRfGqNZENB5qP9ePJQsOQs7JIwyc,6590
57
+ samples/utils/encode_parser.py,sha256=ZAdqlKdS4Wk2L5in1TdcbpZq2dkI74s4FqY5o32CFdY,12374
58
+ samples/utils/frame_utils.py,sha256=a_-JC7NuBLvANTjMY50NBKOj1YXtdB4L_JVInKp2rmI,3478
59
+ samples/utils/sei_message_parser.py,sha256=Z5mZxat-PFKClrNcDHKfwmJYZoNLOok2qZnDCD5FJ0M,10079
60
+ samples/utils/sei_parser.py,sha256=Z5mZxat-PFKClrNcDHKfwmJYZoNLOok2qZnDCD5FJ0M,10079
61
+ samples/utils/transcode_parser.py,sha256=vmOqcYDRuEROWe8eC_z59nNRDUvOEGuBiRa0bxa24Hw,8410
62
+ pynvvideocodec-2.0.4.dist-info/METADATA,sha256=qJmM_v8kcWKZrl00vQBPeUk0qWGjImmHsTx8dvi8yBc,5398
63
+ pynvvideocodec-2.0.4.dist-info/WHEEL,sha256=lJSJzB7E48chEtgyd45Y-ETPqa4r8vlyaMJUG4krwbY,96
64
+ pynvvideocodec-2.0.4.dist-info/top_level.txt,sha256=L7cP7N5LjGw80fJ7i2c9HYNZk7U3G80zVXDKNaffjLg,34
65
+ pynvvideocodec-2.0.4.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: skbuild 0.19.0
3
+ Root-Is-Purelib: false
4
+ Tag: cp314-cp314-win_amd64
5
+
@@ -0,0 +1,22 @@
1
+ SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2
+ SPDX-License-Identifier: MIT
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a
5
+ copy of this software and associated documentation files (the "Software"),
6
+ to deal in the Software without restriction, including without limitation
7
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
+ and/or sell copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20
+ DEALINGS IN THE SOFTWARE.
21
+
22
+
@@ -0,0 +1,167 @@
1
+ This SDK includes portions of FFMPEG, under the following license:
2
+
3
+ GNU LESSER GENERAL PUBLIC LICENSE
4
+ Version 3, 29 June 2007
5
+
6
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
7
+ Everyone is permitted to copy and distribute verbatim copies
8
+ of this license document, but changing it is not allowed.
9
+
10
+
11
+ This version of the GNU Lesser General Public License incorporates
12
+ the terms and conditions of version 3 of the GNU General Public
13
+ License, supplemented by the additional permissions listed below.
14
+
15
+ 0. Additional Definitions.
16
+
17
+ As used herein, "this License" refers to version 3 of the GNU Lesser
18
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
19
+ General Public License.
20
+
21
+ "The Library" refers to a covered work governed by this License,
22
+ other than an Application or a Combined Work as defined below.
23
+
24
+ An "Application" is any work that makes use of an interface provided
25
+ by the Library, but which is not otherwise based on the Library.
26
+ Defining a subclass of a class defined by the Library is deemed a mode
27
+ of using an interface provided by the Library.
28
+
29
+ A "Combined Work" is a work produced by combining or linking an
30
+ Application with the Library. The particular version of the Library
31
+ with which the Combined Work was made is also called the "Linked
32
+ Version".
33
+
34
+ The "Minimal Corresponding Source" for a Combined Work means the
35
+ Corresponding Source for the Combined Work, excluding any source code
36
+ for portions of the Combined Work that, considered in isolation, are
37
+ based on the Application, and not on the Linked Version.
38
+
39
+ The "Corresponding Application Code" for a Combined Work means the
40
+ object code and/or source code for the Application, including any data
41
+ and utility programs needed for reproducing the Combined Work from the
42
+ Application, but excluding the System Libraries of the Combined Work.
43
+
44
+ 1. Exception to Section 3 of the GNU GPL.
45
+
46
+ You may convey a covered work under sections 3 and 4 of this License
47
+ without being bound by section 3 of the GNU GPL.
48
+
49
+ 2. Conveying Modified Versions.
50
+
51
+ If you modify a copy of the Library, and, in your modifications, a
52
+ facility refers to a function or data to be supplied by an Application
53
+ that uses the facility (other than as an argument passed when the
54
+ facility is invoked), then you may convey a copy of the modified
55
+ version:
56
+
57
+ a) under this License, provided that you make a good faith effort to
58
+ ensure that, in the event an Application does not supply the
59
+ function or data, the facility still operates, and performs
60
+ whatever part of its purpose remains meaningful, or
61
+
62
+ b) under the GNU GPL, with none of the additional permissions of
63
+ this License applicable to that copy.
64
+
65
+ 3. Object Code Incorporating Material from Library Header Files.
66
+
67
+ The object code form of an Application may incorporate material from
68
+ a header file that is part of the Library. You may convey such object
69
+ code under terms of your choice, provided that, if the incorporated
70
+ material is not limited to numerical parameters, data structure
71
+ layouts and accessors, or small macros, inline functions and templates
72
+ (ten or fewer lines in length), you do both of the following:
73
+
74
+ a) Give prominent notice with each copy of the object code that the
75
+ Library is used in it and that the Library and its use are
76
+ covered by this License.
77
+
78
+ b) Accompany the object code with a copy of the GNU GPL and this license
79
+ document.
80
+
81
+ 4. Combined Works.
82
+
83
+ You may convey a Combined Work under terms of your choice that,
84
+ taken together, effectively do not restrict modification of the
85
+ portions of the Library contained in the Combined Work and reverse
86
+ engineering for debugging such modifications, if you also do each of
87
+ the following:
88
+
89
+ a) Give prominent notice with each copy of the Combined Work that
90
+ the Library is used in it and that the Library and its use are
91
+ covered by this License.
92
+
93
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
94
+ document.
95
+
96
+ c) For a Combined Work that displays copyright notices during
97
+ execution, include the copyright notice for the Library among
98
+ these notices, as well as a reference directing the user to the
99
+ copies of the GNU GPL and this license document.
100
+
101
+ d) Do one of the following:
102
+
103
+ 0) Convey the Minimal Corresponding Source under the terms of this
104
+ License, and the Corresponding Application Code in a form
105
+ suitable for, and under terms that permit, the user to
106
+ recombine or relink the Application with a modified version of
107
+ the Linked Version to produce a modified Combined Work, in the
108
+ manner specified by section 6 of the GNU GPL for conveying
109
+ Corresponding Source.
110
+
111
+ 1) Use a suitable shared library mechanism for linking with the
112
+ Library. A suitable mechanism is one that (a) uses at run time
113
+ a copy of the Library already present on the user's computer
114
+ system, and (b) will operate properly with a modified version
115
+ of the Library that is interface-compatible with the Linked
116
+ Version.
117
+
118
+ e) Provide Installation Information, but only if you would otherwise
119
+ be required to provide such information under section 6 of the
120
+ GNU GPL, and only to the extent that such information is
121
+ necessary to install and execute a modified version of the
122
+ Combined Work produced by recombining or relinking the
123
+ Application with a modified version of the Linked Version. (If
124
+ you use option 4d0, the Installation Information must accompany
125
+ the Minimal Corresponding Source and Corresponding Application
126
+ Code. If you use option 4d1, you must provide the Installation
127
+ Information in the manner specified by section 6 of the GNU GPL
128
+ for conveying Corresponding Source.)
129
+
130
+ 5. Combined Libraries.
131
+
132
+ You may place library facilities that are a work based on the
133
+ Library side by side in a single library together with other library
134
+ facilities that are not Applications and are not covered by this
135
+ License, and convey such a combined library under terms of your
136
+ choice, if you do both of the following:
137
+
138
+ a) Accompany the combined library with a copy of the same work based
139
+ on the Library, uncombined with any other library facilities,
140
+ conveyed under the terms of this License.
141
+
142
+ b) Give prominent notice with the combined library that part of it
143
+ is a work based on the Library, and explaining where to find the
144
+ accompanying uncombined form of the same work.
145
+
146
+ 6. Revised Versions of the GNU Lesser General Public License.
147
+
148
+ The Free Software Foundation may publish revised and/or new versions
149
+ of the GNU Lesser General Public License from time to time. Such new
150
+ versions will be similar in spirit to the present version, but may
151
+ differ in detail to address new problems or concerns.
152
+
153
+ Each version is given a distinguishing version number. If the
154
+ Library as you received it specifies that a certain numbered version
155
+ of the GNU Lesser General Public License "or any later version"
156
+ applies to it, you have the option of following the terms and
157
+ conditions either of that published version or of any later version
158
+ published by the Free Software Foundation. If the Library as you
159
+ received it does not specify a version number of the GNU Lesser
160
+ General Public License, you may choose any version of the GNU Lesser
161
+ General Public License ever published by the Free Software Foundation.
162
+
163
+ If the Library as you received it specifies that a proxy can decide
164
+ whether future versions of the GNU Lesser General Public License shall
165
+ apply, that proxy's public statement of acceptance of any version is
166
+ permanent authorization for you to choose that version for the
167
+ Library.
@@ -0,0 +1,3 @@
1
+ PyNvVideoCodec
2
+ benchmarks
3
+ samples
@@ -0,0 +1,173 @@
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
+ This sample demonstrates basic video decoding using the native decoder in PyNvVideoCodec.
26
+
27
+ It shows how to:
28
+ 1. Create and use a demuxer to extract packets from a video file
29
+ 2. Set up a basic decoder for hardware-accelerated decoding
30
+ 3. Process packets and decode frames
31
+ 4. Write raw decoded frames to a file
32
+
33
+ Key Learning Outcomes:
34
+ 1. Basic demuxer usage for extracting video packets
35
+ 2. Setting up hardware decoder with default configuration
36
+ 3. Understanding the decode pipeline: Video File -> Demuxer -> Packets -> Decoder -> Raw Frames
37
+ 4. Working with both device and host memory for frame data
38
+ 5. Managing frame count and early termination
39
+
40
+
41
+ Usage: python decode.py -i <input_video_file> -o <output_file> -d <use_device_memory>
42
+ Example: python decode.py -i input.mp4 -o output.yuv -d 1
43
+
44
+ Arguments:
45
+ -i: Input video file
46
+ -o: Output raw video file (default: <input_name>.yuv)
47
+ -d: Use device memory (1) or host memory (0) (default: 1)
48
+ -g: GPU ID to use (default: 0)
49
+ -f: Number of frames to decode (optional, default: all frames)
50
+ '''
51
+
52
+ import sys
53
+ from pathlib import Path
54
+ import PyNvVideoCodec as nvc
55
+ from os.path import join, dirname, abspath, splitext
56
+ # Add the parent directory to Python path in a way that works from any working directory
57
+ current_dir = dirname(abspath(__file__))
58
+ parent_dir = dirname(current_dir)
59
+ if parent_dir not in sys.path:
60
+ sys.path.append(parent_dir)
61
+
62
+ # Import utilities for decoding
63
+ from utils.decode_parser import parse_decode_args
64
+ from utils.Utils import get_frame_data
65
+
66
+
67
+
68
+ def decode(gpu_id, enc_file_path, dec_file_path, use_device_memory, frame_count=None):
69
+ """
70
+ Function to decode media file and write raw frames into an output file.
71
+
72
+ This function demonstrates basic hardware-accelerated video decoding. Here's how it works:
73
+ 1. Creates a demuxer that reads the video file and extracts encoded frame packets
74
+ 2. Sets up a GPU decoder with default configuration
75
+ 3. The demuxer automatically extracts frame packets as you iterate over it
76
+ 4. Each packet is sent to the GPU decoder for hardware-accelerated decoding
77
+ 5. The decoder outputs raw YUV frames that can be processed or saved
78
+
79
+ Parameters:
80
+ gpu_id (int): Ordinal of GPU to use
81
+ enc_file_path (str): Path to file to be decoded
82
+ dec_file_path (str): Path to output file into which raw frames are stored
83
+ use_device_memory (int): If set to 1, output decoded frame is CUDeviceptr wrapped in CUDA Array Interface
84
+ frame_count (int, optional): Maximum number of frames to decode. If None, 0, or negative, decode all frames.
85
+
86
+ Example:
87
+ >>> decode(0, "path/to/input/media/file","path/to/output/yuv", 1)
88
+ Function to decode media file and write raw frames into an output file.
89
+ """
90
+ # Normalize frame count
91
+ decode_all = frame_count is None or frame_count <= 0
92
+ if decode_all:
93
+ print("Decoding all available frames")
94
+ frame_count = None
95
+
96
+ try:
97
+ nv_dmx = nvc.CreateDemuxer(filename=enc_file_path)
98
+
99
+ caps = nvc.GetDecoderCaps(
100
+ gpuid=gpu_id,
101
+ codec=nv_dmx.GetNvCodecId(),
102
+ chromaformat=nv_dmx.ChromaFormat(),
103
+ bitdepth=nv_dmx.BitDepth()
104
+ )
105
+ if "num_decoder_engines" in caps:
106
+ print("Number of NVDECs:", caps["num_decoder_engines"])
107
+
108
+ nv_dec = nvc.CreateDecoder(gpuid=gpu_id,
109
+ codec=nv_dmx.GetNvCodecId(),
110
+ usedevicememory=use_device_memory)
111
+
112
+ # printing out FPS and pixel format of the stream for convenience
113
+ print("FPS =", nv_dmx.FrameRate())
114
+ # open the file to be decoded in write mode
115
+ with open(dec_file_path, "wb") as decFile:
116
+ # demuxer can be iterated, fetch the packet from demuxer
117
+ frames_decoded = 0
118
+ for packet in nv_dmx:
119
+ # Decode returns a list of packets, range of this list is from [0, size of (decode picture buffer)]
120
+ # size of (decode picture buffer) depends on GPU, fur Turing series its 8
121
+ for decoded_frame in nv_dec.Decode(packet):
122
+ frame_data = get_frame_data(decoded_frame, use_device_memory)
123
+ decFile.write(bytearray(frame_data))
124
+
125
+ frames_decoded += 1
126
+ if frame_count is not None and frames_decoded >= frame_count:
127
+ print(f"Successfully decoded requested {frame_count} frames to {dec_file_path}")
128
+ return
129
+
130
+ # If we get here, we've decoded all available frames
131
+ if frame_count is not None and frames_decoded < frame_count:
132
+ print(f"Warning: Video ended before reaching requested frame count. Requested: {frame_count}, Decoded: {frames_decoded}")
133
+ print(f"Decoded frames written to {dec_file_path}")
134
+ else:
135
+ print(f"Successfully decoded all {frames_decoded} frames to {dec_file_path}")
136
+
137
+ except nvc.PyNvVCExceptionUnsupported as e:
138
+ print(f"Operation or configuration not supported: {e}")
139
+ raise
140
+ except cuda.Error as e:
141
+ print(f"CUDA error (context/stream/memory): {e}")
142
+ raise
143
+ except Exception as e:
144
+ print(f"An unexpected error occurred: {e}")
145
+ raise
146
+ finally:
147
+ # Cleanup resources in reverse order of creation
148
+ if nv_dec is not None:
149
+ del nv_dec
150
+ if nv_dmx is not None:
151
+ del nv_dmx
152
+
153
+ if __name__ == "__main__":
154
+ args = parse_decode_args(
155
+ "Basic video demuxing and decoding example. "
156
+ "Shows how to extract packets from a video file and decode them using the NVIDIA decoder."
157
+ )
158
+ print("=" * 60)
159
+ print("Configuration:")
160
+ print(f"Input: {args.encoded_file_path}")
161
+ print(f"Output: {args.raw_file_path}")
162
+ print(f"GPU ID: {args.gpu_id}")
163
+ print(f"Use Device Memory: {args.use_device_memory}")
164
+ print(f"Frame Count: {args.frame_count if args.frame_count else 'All frames'}")
165
+ print("=" * 60)
166
+
167
+ decode(
168
+ gpu_id=args.gpu_id,
169
+ enc_file_path=args.encoded_file_path,
170
+ dec_file_path=args.raw_file_path,
171
+ use_device_memory=args.use_device_memory,
172
+ frame_count=args.frame_count
173
+ )