@@ -93,6 +93,7 @@ ffmpeg -f lavfi -i \
93
93
```
94
94
95
95
## Installing TorchCodec
96
+ ### Installing CPU-only TorchCodec
96
97
97
98
1 . Install the latest stable version of PyTorch following the
98
99
[ official instructions] ( https://pytorch.org/get-started/locally/ ) . For other
@@ -127,6 +128,61 @@ The following table indicates the compatibility between versions of
127
128
| not yet supported | ` 2.5 ` | ` >=3.9 ` , ` <=3.12 ` |
128
129
| ` 0.0.3 ` | ` 2.4 ` | ` >=3.8 ` , ` <=3.12 ` |
129
130
131
+ ### Installing CUDA-enabled TorchCodec
132
+
133
+ First, make sure you have a GPU that has NVDEC hardware that can decode the
134
+ format you want. Refer to Nvidia's GPU support matrix for more details
135
+ [ here] ( https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new ) .
136
+
137
+ 1 . Install CUDA Toolkit. Pytorch and TorchCodec supports CUDA Toolkit
138
+ versions 11.8, 12.1 or 12.4. In particular TorchCodec depends on
139
+ CUDA libraries libnpp and libnvrtc (which are part of CUDA Toolkit).
140
+
141
+ 2 . Install Pytorch that corresponds to your CUDA Toolkit version using the
142
+ [ official instructions] ( https://pytorch.org/get-started/locally/ ) .
143
+
144
+ 3 . Install or compile FFmpeg with NVDEC support.
145
+ TorchCodec with CUDA should work with FFmpeg versions in [ 4, 7] .
146
+
147
+ If FFmpeg is not already installed, or you need a more recent version, an
148
+ easy way to install it is to use ` conda ` :
149
+
150
+ ``` bash
151
+ conda install ffmpeg
152
+ # or
153
+ conda install ffmpeg -c conda-forge
154
+ ```
155
+
156
+ If you are building FFmpeg from source you can follow Nvidia's guide to
157
+ configuring and installing FFmpeg with NVDEC support
158
+ [ here] ( https://docs.nvidia.com/video-technologies/video-codec-sdk/12.0/ffmpeg-with-nvidia-gpu/index.html ) .
159
+
160
+ After installing FFmpeg make sure it has NVDEC support when you list the supported
161
+ decoders:
162
+
163
+ ``` bash
164
+ ffmpeg -decoders | grep -i nvidia
165
+ # This should show a line like this:
166
+ # V..... h264_cuvid Nvidia CUVID H264 decoder (codec h264)
167
+ ```
168
+
169
+ To check that FFmpeg libraries work with NVDEC correctly you can decode a sample video:
170
+
171
+ ``` bash
172
+ ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i test/resources/nasa_13013.mp4 -f null -
173
+ ```
174
+
175
+ 4 . Install TorchCodec by passing in an ` --index-url ` parameter that corresponds to your CUDA
176
+ Toolkit version, example:
177
+
178
+ ``` bash
179
+ # This corresponds to CUDA Toolkit version 12.4 and nightly Pytorch.
180
+ pip install torchcodec --index-url=https://download.pytorch.org/whl/nightly/cu124
181
+ ```
182
+
183
+ Note that without passing in the ` --index-url ` parameter, ` pip ` installs TorchCodec
184
+ binaries from PyPi which are CPU-only and do not have CUDA support.
185
+
130
186
## Benchmark Results
131
187
132
188
The following was generated by running [ our benchmark script] ( ./benchmarks/decoders/generate_readme_data.py ) on a lightly loaded 56-core machine.
0 commit comments