26 lines
645 B
Python
26 lines
645 B
Python
import pycuda.driver as cuda_driver
|
|
import PyNvVideoCodec as nvc
|
|
|
|
gpu_id = 0
|
|
cuda_driver.init()
|
|
cudaDevice = cuda_driver.Device(gpu_id)
|
|
cudaCtx = cudaDevice.retain_primary_context()
|
|
cudaCtx.push()
|
|
cudaStreamNvDec = cuda_driver.Stream()
|
|
|
|
|
|
#def create_decoder(enc_file_path, buffer_size = 16):
|
|
|
|
decoder = nvc.ThreadedDecoder(
|
|
enc_file_path = '/home/thebears/Source/task_runners/vision_v3/cuda_objdet_clip/loaders/output.mp4',
|
|
buffer_size=32,
|
|
gpu_id=gpu_id,
|
|
cuda_context=cudaCtx.handle,
|
|
cuda_stream=cudaStreamNvDec.handle,
|
|
use_device_memory=True,
|
|
output_color_type=nvc.OutputColorType.RGBP,
|
|
)
|
|
# return decoder
|
|
|
|
|