[FFmpeg-user] nvenc and parallel process memory leaks?

Paweł Bajorek pawel at ap-media.pl
Sun Dec 6 21:41:24 EET 2020


I have a problem with transcoding using nvenc. The problem is incresing 
memory consumption, it is about of hundreds kB/s.

Im transcoding parallel exactly 74 streams to hls. After many hours some 
processes are killed by oom_killer. It can be restarted, but in this 
case i have less and less memory and so i cant restart it. oom_killer 
starts about 30 hours after start transcoding.

im using newest version which is available from git for ffmpeg 
(sources), cuda version 11.02, and compiled with:

pkg_config='pkg-config --static' --enable-nonfree --enable-cuda 
--extra-cflags=-I/root/ffmpeg/include --extra-ldflags=-L/root/ffmpeg/lib 
--enable-cuvid --enable-nvenc --extra-cflags=-I/usr/local/cuda/include 
--extra-ldflags=-L/usr/local/cuda/lib64 --enable-gpl --enable-libnpp 
--enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libopus 

on Ubuntu LTS 18.04

below is cmd im using:

ffmpeg -vsync 1 -copytb 1 -analyzeduration 10000000 -probesize 10000000 
-hwaccel cuvid -c:v h264_cuvid -hwaccel_device 0 -deint 1 
-drop_second_field 1 -overrun_nonfatal 1 -fifo_size 713924 -buffer_size 
67108864 -f mpegts -i "udp://"?timeout=5000000 
-map [map:v:0] -map [map:v:1] -map [map:v:2] -map [map:v:3] -map a:0 
-map a:0 -map a:0 -map a:0 -ac 2 -ar 44100 -c:v:0 h264_nvenc 
-profile:v:0 baseline -c:v:1 h264_nvenc -b:v:1 3072k -maxrate:v:1 3072k 
-profile:v:1 baseline -c:v:2 h264_nvenc -b:v:2 1536k -maxrate:v:2 1536k 
-profile:v:2 baseline -c:v:3 h264_nvenc -b:v:3 300k -maxrate:v:3 300k 
-profile:v:3 baseline -c:a:0 libfdk_aac -b:a:0 128k -c:a:1 libfdk_aac 
-b:a:1 128k -c:a:2 libfdk_aac -b:a:2 64k -c:a:3 libfdk_aac -b:a:3 32k 
-metadata service_provider="SPI" -metadata service_name="Kino Polska HD" 
-max_muxing_queue_size 512 -flush_packets 1 -preset:v fast -gpu 0 
-flags:v +global_header+cgop -movflags +faststart -mpegts_service_id 
0x2fb8 -mpegts_pmt_start_pid 0x3ee -g 125 -f tee 
v:1,a:1 v:2,a:2 v:3,a:3\']/opt/streams/cache/hls/20/playlist_%v.m3u8"

I tired with -rtbufsize, -re, -deint 2 (it was before, i read that it 
can be problem so i changed to 1 and it not helps).

Could somebady helps with it?

Paweł Bajorek

More information about the ffmpeg-user mailing list