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

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


Hi,

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 
--disable-pthreads

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://239.254.2.217:6060"?timeout=5000000 
-filter_complex 
"[0:v]split=outputs=4[map:v:0][v1][v2][v3];[v1]scale_npp=-1:720[map:v:1];[v2]scale_npp=-1:480[map:v:2];[v3]scale_npp=-1:360[map:v:3]" 
-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 
"[select=\'a:0,v:0,a:1,v:1,a:2,v:2,a:3,v:3\':f=hls:hls_list_size=10:hls_segment_filename=/opt/streams/cache/hls/20/playlist_%v_%d.ts:hls_flags=delete_segments:master_pl_name=20.m3u8:var_stream_map=\'v:0,a:0 
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