Camera Rendering Buffers and Stutters When Processing Large Video Files with FFmpeg

Hi NVIDIA support team,

When rendering a real-time camera, I use ffmpeg to process a large video file(like 4G or even larger) at the same time. However, I noticed that the video frames are buffering and stuttering, indicated they are probably competing for limited system resources, like cpu, memory or I/O bandwidth etc.

I‘ve tried a lot of experiments to figure out the root cause. Firstly I limit the cpu usage of ffmpeg to 25%, but sadly it’s not getting better.

Then I suspect that ffmpeg would read the large video file from disk to page cache in memory as much as it can before processing, and the generated files are going to be written back from page cache to disk. The RAM of our computer is 8G, apparently it needs to swap in and swap out pages between memory and disk. This process is costly for the CPU, and other processes are likely to trigger an interrupt named “Page Fault” when they access pages that are not actually loaded into memory. If the time taken for “page fault” is too long, the program may lag.

Lastly I configure the system parameters related to “write back dirty pages to disk”, such as vm.dirty_writeback_centisecs and vm.dirty_background_ratio, to try to write back the dirty (Disk I/O) more frequently or infrequently. But I’m not quite sure what would happen if I modify these parameters.

The requirement can be summarized as real-time video rendering has higher priority, and the low rate of large file processing is accepted, are there any possible solutions of this issue from your perspective? Thanks in advance.

Duplicated with Camera Rendering Buffers and Stutters When Processing Large Video Files with FFmpeg - Jetson & Embedded Systems / Jetson Xavier NX - NVIDIA Developer Forums