Trying to load the video for NVIDIA DALI pipeline for video processing but not able to load the .mp4 video.
import os
import numpy as np
from nvidia.dali import pipeline_def
import nvidia.dali.fn as fn
import nvidia.dali.types as types
batch_size=2
sequence_length=8
initial_prefetch_size=16
video_directory=['sintel_trailer-720p_0.mp4']
n_iter=6
print(video_directory)
@pipeline_def
def video_pipe(file_root):
video, labels = fn.readers.video(device="gpu", file_root=file_root, sequence_length=sequence_length,
random_shuffle=True, initial_fill=initial_prefetch_size)
return video, labels
pipe = video_pipe(batch_size=batch_size, num_threads=2, device_id=0, file_root=video_directory, seed=12345)
pipe.build()
Above DALI pipeline shows the following issue while loading the video:
RuntimeError: Critical error when building pipeline: Error when constructing operator: readers__Video encountered: [/opt/dali/dali/operators/reader/loader/video_loader.cc:117] Assert on "dir != nullptr" failed: Directory ['sintel_trailer-720p_0.mp4'] could not be opened.
I have referred the documentation from NVIDIA DALI for video processing but not to able solve,
Please check for reference : NVIDIA DALI DOCS VIDEO PROCESSING
The
file_rootargument points to the root directory, where DALI should search for videos, and thefile_listargument should point to a file listing all samples to be loaded.However, from your example, the
filenamesargument must be the one that suits your needs better.Your example should work as expected, with the following pipeline definition:
I added the
labelsargument too. Without it, the operator returns just one output. Please see the DALI manual if you want to understand the operator better.