[FFmpeg-trac] #9082(avcodec:open): Memory leak while trancoding on GPU

FFmpeg trac at avcodec.org
Mon Jun 7 19:34:22 EEST 2021


#9082: Memory leak while trancoding on GPU
-------------------------------------+-------------------------------------
             Reporter:  misko        |                    Owner:  (none)
                 Type:  defect       |                   Status:  open
             Priority:  important    |                Component:  avcodec
              Version:  git-master   |               Resolution:
             Keywords:  cuda         |               Blocked By:
  regression                         |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Comment (by Dhanish Vijayan):

 Hi,
 I was struggling with the exact same issue for last couple of days.
 In my case, I have a batch process with 75 parallel transcodes with cuvid.
 The memory is leaked by '''1.6GB per hour for 75 transcoding process'''. I
 ran the test against the latest master branch, 4.4 and 4.3 releases. All
 of these have the same issue.

 I am using the following command, similar to that mentioned in this thread

 {{{
 ./ffmpeg -y -re -vsync 0 -hwaccel cuda -hwaccel_output_format cuda
 -hwaccel_device 1 -resize 1280x720 -i
 "udp://239.0.1.0:1044?pkt_size=1316&localaddr=127.0.0.1&overrun_nonfatal=1&fifo_size=100000"
 -filter_complex "[0:v:0]split=2[s0][s1];[s1]scale_npp=h=360:w=640[s2]"
 -map [s0] -map 0:a:0 -map [s2] -map 0:a:0 -c:v:0 h264_nvenc -b:v:0 2200k
 -gpu:v:0 1 -preset:v:0 hp -profile:v:0 high -level:v:0 4.1 -a53cc:v:0 1
 -no-scenecut:v:0 1 -forced-idr:v:0 1 -strict_gop:v:0 1 -c:v:1 h264_nvenc
 -b:v:1 800k -gpu:v:1 1 -preset:v:1 hp -profile:v:1 high -level:v:1 3.1
 -a53cc:v:1 1 -no-scenecut:v:0 1 -forced-idr:v:0 1 -strict_gop:v:0 1 -c:a
 libfdk_aac -b:a 128k -ac 2 -f hls -hls_list_size 4 -hls_flags
 delete_segments -hls_delete_threshold 1 -hls_time 4 -hls_segment_filename
 abr/fx/stream_%v/fileSequence%d.ts -forced-idr 1 -force_key_frames
 "expr:gte(t,n_forced*2)" -sc_threshold 0 -master_pl_name playlist.m3u8
 -var_stream_map "v:0,a:0,name:720 v:1,a:1,name:360"
 abr/fx/stream_%v/prog_index.m3u8

 }}}

 I played with valgrind as well to see where the memory is leaking, but
 couldn't get any useful information.


 I even tried without libnpp filters, and used output to go to /dev/null to
 isolate the leak. After these experiments, I saw this thread and see the
 commit 022a12b306 introduced the issue. So I created a new branch just
 before this commit 022a12b306 and this time there is no leak.

 Let me know if there is any patches available for testing this. I will be
 happy to do the testing as I would like to make the transcoder upto date
 with latest ffmpeg release.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9082#comment:19>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list