[FFmpeg-trac] #8225(undetermined:new): NVIDIA Driver Bug Affecting Full HW Based Transcoding

FFmpeg trac at avcodec.org
Mon Oct 7 12:36:08 EEST 2019


#8225: NVIDIA Driver Bug Affecting Full HW Based Transcoding
-------------------------------------+-------------------------------------
             Reporter:               |                     Type:  defect
  smallishzulu                       |
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:  nvenc,       |               Blocked By:
  cuviddec                           |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 The NVIDIA Driver series 430.X & 435.X have an issue which is affecting
 the full HW based transcoding.
 The probem comes to surface, when you try hw decode an input stream and
 scale & transcode it with multiple profiles.
 (There can be other scenarios got affected. This is the one I noticed.)

 Example command line to test:

 GPULOWER=0 && /opt/ffmpeg/bin/ffmpeg  -hide_banner -ignore_unknown
 -loglevel verbose -async 1 -thread_queue_size 2048   -fflags
 +nobuffer+discardcorrupt  -re  -hwaccel_device $GPULOWER -hwaccel cuvid
 -c:v h264_cuvid -i
 'udp://239.1.5.2:5000?fifo_size=3355440&buffer_size=3355440&overrun_nonfatal=1'
 -filter_complex
 '[0:p:16401:0]scale_npp=1920:1080[v0];[0:p:16401:0]scale_npp=1280:720[v1];[0:p:16401:0]scale_npp=960:540[v2];[0:p:16401:0]scale_npp=704:396[v3];[0:p:16401:0]scale_npp=480:270[v4];[0:p:16401:0]scale_npp=416:234[v5];[0:p:16401:0]scale_npp=416:234[v6]'
 -g 50 -r 25  -map [v0] -c:v:0 h264_nvenc -qmin 19 -preset hq -rc:v vbr_hq
 -profile:v main -level 4.1 -strict_gop 1 -rc-lookahead 32 -no-scenecut 1
 -forced-idr 1       -gpu $GPULOWER -b:v:0 6000k -maxrate:v:0 6000k  -map
 [v1] -c:v:1 h264_nvenc -qmin 19 -preset hq -rc:v vbr_hq  -profile:v main
 -level 4.1 -strict_gop 1 -rc-lookahead 32 -no-scenecut 1 -forced-idr 1
 -gpu $GPULOWER -b:v:1 3150k -maxrate:v:1 3150k  -map [v2] -c:v:2
 h264_nvenc -qmin 19 -preset hq -rc:v vbr_hq  -profile:v main -level 4.1
 -strict_gop 1 -rc-lookahead 32 -no-scenecut 1 -forced-idr 1       -gpu
 $GPULOWER -b:v:2 2000k -maxrate:v:2 2000k  -map [v3] -c:v:3 h264_nvenc
 -qmin 19 -preset hq -rc:v vbr_hq  -profile:v main -level 4.1 -strict_gop 1
 -rc-lookahead 32 -no-scenecut 1 -forced-idr 1       -gpu $GPULOWER -b:v:3
 1400k -maxrate:v:3 1400k  -map [v4] -c:v:4 h264_nvenc -qmin 19 -preset hq
 -rc:v vbr_hq  -profile:v main -level 4.1 -strict_gop 1 -rc-lookahead 32
 -no-scenecut 1 -forced-idr 1       -gpu $GPULOWER -b:v:4 800k -maxrate:v:4
 800k  -map [v5] -c:v:5 h264_nvenc -qmin 19 -preset hq -rc:v vbr_hq
 -profile:v main -level 4.1 -strict_gop 1 -rc-lookahead 32 -no-scenecut 1
 -forced-idr 1       -gpu $GPULOWER -b:v:5 400k -maxrate:v:5 400k  -map
 [v6] -c:v:6 h264_nvenc -qmin 19 -preset hq -rc:v vbr_hq  -profile:v main
 -level 4.1 -strict_gop 1 -rc-lookahead 32 -no-scenecut 1 -forced-idr 1
 -gpu $GPULOWER -b:v:6 200k -maxrate:v:6 200k   -map 0:p:16401:1 -c:a:0 aac
 -b:a:0 96k -metadata:s:a:0 language=eng  -max_muxing_queue_size 1000  -f
 matroska -y /dev/null

 Running a single instance of above command work without a problem.
 If you run the same command on a new shell:

 1) 1st running shell's encode halts. If you wait enough, there will be
 circular buffer overrun messages for decode.
 OR
 2) 2nd shell will throw out below error (ffmpeg does not exit, If you wait
 enough, there will be circular buffer overrun messages for decode):
 [h264_nvenc @ 0x8e3d00] Failed locking bitstream buffer: invalid param (8)
 Video encoding failed

 I gdp the ffmpeg process:


 Program received signal SIGINT, Interrupt.
 sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
 85      ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S: No such file or
 directory.
 (gdb) bt
 #0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
 #1  0x00007fffc1904257 in ?? () from /usr/lib/x86_64-linux-
 gnu/libcuda.so.1
 #2  0x00007fffc17ff2a3 in ?? () from /usr/lib/x86_64-linux-
 gnu/libcuda.so.1
 #3  0x00007fffc19c1f10 in ?? () from /usr/lib/x86_64-linux-
 gnu/libcuda.so.1
 #4  0x00007fffc18a821c in ?? () from /usr/lib/x86_64-linux-
 gnu/libcuda.so.1
 #5  0x00007fffc17df22c in ?? () from /usr/lib/x86_64-linux-
 gnu/libcuda.so.1
 #6  0x00007fffc19485f0 in cuMemFree_v2 () from /usr/lib/x86_64-linux-
 gnu/libcuda.so.1
 #7  0x00007ffff4fc8113 in ?? () from /opt/ffmpeg/lib/libavutil.so.56
 #8  0x00007ffff4fb7bd7 in av_buffer_pool_uninit () from
 /opt/ffmpeg/lib/libavutil.so.56
 #9  0x00007ffff4fc5bb0 in ?? () from /opt/ffmpeg/lib/libavutil.so.56
 #10 0x00007ffff4fb781f in av_buffer_unref () from
 /opt/ffmpeg/lib/libavutil.so.56
 #11 0x00007ffff78360c7 in ?? () from /opt/ffmpeg/lib/libavfilter.so.7
 #12 0x00007ffff77395f3 in avfilter_free () from
 /opt/ffmpeg/lib/libavfilter.so.7
 #13 0x00007ffff773b35c in avfilter_graph_free () from
 /opt/ffmpeg/lib/libavfilter.so.7
 #14 0x0000000000424efb in ?? ()
 #15 0x0000000000417751 in ?? ()
 #16 0x00000000004240ff in ?? ()

 Same command with Driver 418.88 with multiple instances do not have any
 problem.
 libcuda.so.1 is related with driver

 FFmpeg version:
 ffmpeg version N-94767-ge9cc873 Copyright (c) 2000-2019 the FFmpeg
 developers
   built with gcc 6.5.0 (Ubuntu 6.5.0-2ubuntu1~14.04.1) 20181026
   configuration: --prefix=/opt/ffmpeg --enable-nonfree --enable-gpl
 --extra-cflags='-I/opt/ffmpeg/include -I/usr/local/include
 -I/usr/local/cuda/include -I/opt/lib/NDISDK/ndi/include
 -I/opt/lib/subsys/include' --extra-ldflags='-L/opt/ffmpeg/lib
 -L/usr/local/cuda/lib64 -L/opt/lib/NDISDK/ndi/lib/x86_64-linux-gnu
 -L/opt/lib/subsys/lib' --bindir=/opt/ffmpeg/bin --extra-libs=-ldl
 --enable-libx264 --enable-libx265 --enable-nonfree --enable-gpl --enable-
 nvenc --enable-libzvbi --enable-libfdk-aac --enable-libzimg --enable-
 libzmq --enable-libfreetype --enable-static --enable-shared --enable-vdpau
 --enable-cuda --enable-cuvid --enable-libmp3lame --enable-vaapi --enable-
 openssl --enable-ffnvcodec --enable-libfontconfig --enable-libfribidi
 --enable-cuda-nvcc --enable-libnpp --disable-debug
 --nvcc=/usr/local/cuda/bin/nvcc --enable-opencl --enable-libmfx --enable-
 libndi_newtek --enable-libtesseract --enable-libass --enable-opencl
   libavutil      56. 34.100 / 56. 34.100
   libavcodec     58. 56.114 / 58. 56.114
   libavformat    58. 32.104 / 58. 32.104
   libavdevice    58.  9.100 / 58.  9.100
   libavfilter     7. 58.102 /  7. 58.102
   libswscale      5.  6.100 /  5.  6.100
   libswresample   3.  6.100 /  3.  6.100
   libpostproc    55.  6.100 / 55.  6.100
 Hyper fast Audio and Video encoder
 usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options]
 outfile}...

 Use -h to get full help or, even better, run 'man ffmpeg'


 FFmpeg version does not change the behaviour.
 I thought the case is maybe related with
 https://trac.ffmpeg.org/ticket/7582 ticket.
 I did the changes mentioned in diff patch. Same behaviour continues.

 I think it is needed to report to NVIDIA.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8225>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list