Search code examples
videoframenvidiavideo-processing

How to extract frames from videos at a certain fps (ex. 15fps) using nvidia-dali?


I have tried to follow the official documentation and examples of DALI. But i am at a loss to understand the meaning and use of the three following variables -

  1. batch_size
  2. sequence_length
  3. n_iter

Official documentation link- https://docs.nvidia.com/deeplearning/dali/user-guide/docs/examples/sequence_processing/video/video_reader_simple_example.html

Thanks in advance.


Solution

  • Answering the question from the title, DALI loads all frames from the input video with default settings. If your video is recorded with 30 FPS, you can read it as 15 FPS by setting argument stride=2 (DALI will skip every second frame).

    To explain the meaning of the variables in the tutorial:

    1. batch_size: DALI operators can run on GPU (when device="gpu" is set), and GPU is designed for parallel computation. The batch_size variable tells DALI how many videos to process in parallel.
    2. sequence_length: tells how many frames DALI will include in the output.
    3. n_iter: it is just for the tutorial. The loop in the example below will run the pipeline this many times.