[FFmpeg-trac] #8254(undetermined:new): ffmpeg encoding with nvenc broken by a commit

FFmpeg trac at avcodec.org
Fri Oct 11 10:27:39 EEST 2019


#8254: ffmpeg encoding with nvenc broken by a commit
-------------------------------------+-------------------------------------
             Reporter:  hydra3333    |                     Type:  defect
               Status:  new          |                 Priority:  important
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Hello.
 Summary of the bug:
 One of these commits "broke" nvenc in ffmpeg when using a 1050Ti :-

 13 days ago     Timo Rothenpieler       avcodec/nvenc: make use of new
 GetLastErrorString function      commit | commitdiff | tree
 ab0ef1abdf53e257f7628f2d264adc80038f3bcb
 13 days ago     Timo Rothenpieler       avcodec/nvenc: pass CUstream to
 nvenc when available    commit | commitdiff | tree
 51a23343d9c736217d8845b7442fafc373726433
 13 days ago     Roman Arzumanyan        avcodec/nvenc: add multiple
 reference frames support    commit | commitdiff | tree
 567b5e33d9d77919ee920c091f4273c5b38fc821
 13 days ago     Timo Rothenpieler       avcodec/nvenc: switch to dedicated
 dpb_size option      commit | commitdiff | tree
 e929b2f248a9c49761475e07d1a089e05912d1c6

 Commit 460f74495fa93c4bb85503c5443580e2bb857efa, which is *just prior* the
 bottom commit, *works* on both a "1050Ti" and a "2060 Super".

 The top commit ab0ef1abdf53e257f7628f2d264adc80038f3bcb
 - *works* on a "2060 Super"
 - *fails* on a "1050Ti" with error "No NVENC capable devices found"
 when using identical drivers, input file, commandline, etc.
 Both PCs: Win10 Pro x64 fully patched, latest Nvidia driver 436.48, the
 same copy of ffmpeg.exe built with
 ab0ef1abdf53e257f7628f2d264adc80038f3bcb
 PCs: i4670 with "1050Ti", 3900X with "2060 Super".
 ffmpeg cross-compiled on ubuntu.

 How to reproduce:
 {{{
 "C:\SOFTWARE\ffmpeg\0-homebuilt-x64\ffmpeg.exe" -hide_banner -nostats -v
 verbose -init_hw_device opencl=ocl:0.0 -filter_hw_device ocl -i
 "D:\temp\SCRATCH\demo1.mpg" -map_metadata -1 -sws_flags
 lanczos+accurate_rnd+full_chroma_int+full_chroma_inp -filter_complex
 "[0:v]yadif=0:0:0,hwupload,unsharp_opencl=lx=3:ly=3:la=0.5:cx=3:cy=3:ca=0.5,hwdownload,format=pix_fmts=yuv420p,setdar=dar=16/9"
 -c:v h264_nvenc -pix_fmt nv12 -preset slow -bf 2 -g 50 -refs 3 -rc:v
 vbr_hq -rc-lookahead:v 32 -cq 22 -qmin 16 -qmax 25 -coder cabac -strict
 experimental -movflags +faststart+write_colr -profile:v high -level 5.1
 -af
 loudnorm=I=-16:TP=0.0:LRA=11:measured_I=-24.17:measured_LRA=7.30:measured_TP=-5.13:measured_thresh=-34.87:offset=-0.19:linear=true:print_format=summary
 -c:a libfdk_aac -cutoff 18000 -ab 384k -ar 48000  -y "T:\HDTV\autoTVS-
 mpg\Converted\demo1.aac.mp4"
 }}}
 built on ... using commit ab0ef1abdf53e257f7628f2d264adc80038f3bcb

 Logs showing the issue:

 1. from the "1050Ti" failure using commit
 ab0ef1abdf53e257f7628f2d264adc80038f3bcb
 --------------------------------------------------------------------------------------------------------------
 "C:\SOFTWARE\ffmpeg\0-homebuilt-x64\ffmpeg.exe" -hide_banner -v verbose
 -init_hw_device list
 Supported hardware device types:
 cuda
 dxva2
 qsv
 d3d11va
 opencl
 --------------------------------------------------------------------------------------------------------------
 "C:\SOFTWARE\ffmpeg\0-homebuilt-x64\ffmpeg.exe" -hide_banner -v verbose
 -init_hw_device opencl
 [AVHWDeviceContext @ 0000026d5440c640] 0.0: NVIDIA CUDA / GeForce GTX 1050
 Ti
 [AVHWDeviceContext @ 0000026d5440c640] 1.0: Intel(R) CPU Runtime for
 OpenCL(TM) Applications / Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz
 [AVHWDeviceContext @ 0000026d5440c640] 2.0: Intel(R) OpenCL / Intel(R) HD
 Graphics 4600
 [AVHWDeviceContext @ 0000026d5440c640] 2.1: Intel(R) OpenCL / Intel(R)
 Core(TM) i5-4670 CPU @ 3.40GHz
 [AVHWDeviceContext @ 0000026d5440c640] More than one matching device
 found.
 Device creation failed: -19.
 Failed to set value 'opencl' for option 'init_hw_device': No such device
 Error parsing global options: No such device
 --------------------------------------------------------------------------------------------------------------
 "C:\SOFTWARE\ffmpeg\0-homebuilt-x64\ffmpeg.exe" -hide_banner -v verbose
 -init_hw_device opencl:0.0
 [AVHWDeviceContext @ 0000024a4c3ac6c0] 0.0: NVIDIA CUDA / GeForce GTX 1050
 Ti
 [AVHWDeviceContext @ 0000024a4c3ac6c0] DXVA2 to OpenCL mapping function
 found (clCreateFromDX9MediaSurfaceKHR).
 [AVHWDeviceContext @ 0000024a4c3ac6c0] DXVA2 in OpenCL acquire function
 found (clEnqueueAcquireDX9MediaSurfacesKHR).
 [AVHWDeviceContext @ 0000024a4c3ac6c0] DXVA2 in OpenCL release function
 found (clEnqueueReleaseDX9MediaSurfacesKHR).
 [AVHWDeviceContext @ 0000024a4c3ac6c0] The cl_khr_d3d11_sharing extension
 is required for D3D11 to OpenCL mapping.
 [AVHWDeviceContext @ 0000024a4c3ac6c0] D3D11 to OpenCL mapping not usable.
 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'
 --------------------------------------------------------------------------------------------------------------
 "C:\SOFTWARE\ffmpeg\0-homebuilt-x64\ffmpeg.exe" -hide_banner -nostats -v
 verbose -init_hw_device opencl=ocl:0.0 -filter_hw_device ocl -i
 "D:\temp\SCRATCH\demo1.mpg" -map_metadata -1 -sws_flags
 lanczos+accurate_rnd+full_chroma_int+full_chroma_inp -filter_complex
 "[0:v]yadif=0:0:0,hwupload,unsharp_opencl=lx=3:ly=3:la=0.5:cx=3:cy=3:ca=0.5,hwdownload,format=pix_fmts=yuv420p,setdar=dar=16/9"
 -c:v h264_nvenc -pix_fmt nv12 -preset slow -bf 2 -g 50 -refs 3 -rc:v
 vbr_hq -rc-lookahead:v 32 -cq 22 -qmin 16 -qmax 25 -coder cabac -strict
 experimental -movflags +faststart+write_colr -profile:v high -level 5.1
 -af
 loudnorm=I=-16:TP=0.0:LRA=11:measured_I=-24.17:measured_LRA=7.30:measured_TP=-5.13:measured_thresh=-34.87:offset=-0.19:linear=true:print_format=summary
 -c:a libfdk_aac -cutoff 18000 -ab 384k -ar 48000  -y "T:\HDTV\autoTVS-
 mpg\Converted\demo1.aac.mp4"
 Routing option strict to both codec and muxer layer
 [AVHWDeviceContext @ 000001a18997ef40] 0.0: NVIDIA CUDA / GeForce GTX 1050
 Ti
 [AVHWDeviceContext @ 000001a18997ef40] DXVA2 to OpenCL mapping function
 found (clCreateFromDX9MediaSurfaceKHR).
 [AVHWDeviceContext @ 000001a18997ef40] DXVA2 in OpenCL acquire function
 found (clEnqueueAcquireDX9MediaSurfacesKHR).
 [AVHWDeviceContext @ 000001a18997ef40] DXVA2 in OpenCL release function
 found (clEnqueueReleaseDX9MediaSurfacesKHR).
 [AVHWDeviceContext @ 000001a18997ef40] The cl_khr_d3d11_sharing extension
 is required for D3D11 to OpenCL mapping.
 [AVHWDeviceContext @ 000001a18997ef40] D3D11 to OpenCL mapping not usable.
 [mpeg @ 000001a18b161c40] max_analyze_duration 5000000 reached at 5000000
 microseconds st:0
 Input #0, mpeg, from 'D:\temp\SCRATCH\demo1.mpg':
   Duration: 00:44:49.53, start: 0.228244, bitrate: 3781 kb/s
     Stream #0:0[0x1e0]: Video: mpeg2video (Main), 1 reference frame,
 yuv420p(tv, bt470bg, top first, left), 720x576 [SAR 64:45 DAR 16:9], 25
 fps, 25 tbr, 90k tbn, 50 tbc
     Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 256 kb/s
 Stream mapping:
   Stream #0:0 (mpeg2video) -> yadif (graph 0)
   setdar (graph 0) -> Stream #0:0 (h264_nvenc)
   Stream #0:1 -> #0:1 (mp2 (native) -> aac (libfdk_aac))
 Press [q] to stop, [?] for help
 [graph 0 input from stream 0:0 @ 000001a19895ba80] w:720 h:576
 pixfmt:yuv420p tb:1/90000 fr:25/1 sar:64/45 sws_param:flags=2
 [auto_scaler_0 @ 000001a19895a940] w:iw h:ih flags:'bilinear' interl:0
 [format @ 000001a18b1d6dc0] auto-inserting filter 'auto_scaler_0' between
 the filter 'Parsed_setdar_5' and the filter 'format'
 [Parsed_setdar_5 @ 000001a1987a6200] w:720 h:576 dar:16/9 sar:64/45 ->
 dar:16/9 sar:64/45
 [auto_scaler_0 @ 000001a19895a940] w:720 h:576 fmt:yuv420p sar:64/45 ->
 w:720 h:576 fmt:nv12 sar:64/45 flags:0x2
 [h264_nvenc @ 000001a18b168cc0] Loaded Nvenc version 9.1
 [h264_nvenc @ 000001a18b168cc0] Nvenc initialized successfully
 [h264_nvenc @ 000001a18b168cc0] 1 CUDA capable devices found
 [h264_nvenc @ 000001a18b168cc0] [ GPU #0 - < GeForce GTX 1050 Ti > has
 Compute SM 6.1 ]
 [h264_nvenc @ 000001a18b168cc0] Multiple reference frames are not
 supported
 [h264_nvenc @ 000001a18b168cc0] No NVENC capable devices found
 [h264_nvenc @ 000001a18b168cc0] Nvenc unloaded
 Error initializing output stream 0:0 -- Error while opening encoder for
 output stream #0:0 - maybe incorrect parameters such as bit_rate, rate,
 width or height
 [AVIOContext @ 000001a18b1fad80] Statistics: 0 seeks, 0 writeouts
 [AVIOContext @ 000001a18b16a640] Statistics: 2642064 bytes read, 2 seeks
 Conversion failed!
 --------------------------------------------------------------------------------------------------------------

 2. from the "2060 Super" success using the identical ffmpeg.exe which is
 commit ab0ef1abdf53e257f7628f2d264adc80038f3bcb
 --------------------------------------------------------------------------------------------------------------
 "C:\SOFTWARE\ffmpeg\0-homebuilt-x64\ffmpeg.exe" -hide_banner -v verbose
 -init_hw_device list
 Supported hardware device types:
 cuda
 dxva2
 qsv
 d3d11va
 opencl
 --------------------------------------------------------------------------------------------------------------
 "C:\SOFTWARE\ffmpeg\0-homebuilt-x64\ffmpeg.exe" -hide_banner -v verbose
 -init_hw_device opencl
 [AVHWDeviceContext @ 000001e43031c640] 0.0: NVIDIA CUDA / GeForce RTX 2060
 SUPER
 [AVHWDeviceContext @ 000001e43031c640] DXVA2 to OpenCL mapping function
 found (clCreateFromDX9MediaSurfaceKHR).
 [AVHWDeviceContext @ 000001e43031c640] DXVA2 in OpenCL acquire function
 found (clEnqueueAcquireDX9MediaSurfacesKHR).
 [AVHWDeviceContext @ 000001e43031c640] DXVA2 in OpenCL release function
 found (clEnqueueReleaseDX9MediaSurfacesKHR).
 [AVHWDeviceContext @ 000001e43031c640] The cl_khr_d3d11_sharing extension
 is required for D3D11 to OpenCL mapping.
 [AVHWDeviceContext @ 000001e43031c640] D3D11 to OpenCL mapping not usable.
 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'
 --------------------------------------------------------------------------------------------------------------
 "C:\SOFTWARE\ffmpeg\0-homebuilt-x64\ffmpeg.exe" -hide_banner -v verbose
 -init_hw_device opencl:0.0
 [AVHWDeviceContext @ 0000020a9b2fc6c0] 0.0: NVIDIA CUDA / GeForce RTX 2060
 SUPER
 [AVHWDeviceContext @ 0000020a9b2fc6c0] DXVA2 to OpenCL mapping function
 found (clCreateFromDX9MediaSurfaceKHR).
 [AVHWDeviceContext @ 0000020a9b2fc6c0] DXVA2 in OpenCL acquire function
 found (clEnqueueAcquireDX9MediaSurfacesKHR).
 [AVHWDeviceContext @ 0000020a9b2fc6c0] DXVA2 in OpenCL release function
 found (clEnqueueReleaseDX9MediaSurfacesKHR).
 [AVHWDeviceContext @ 0000020a9b2fc6c0] The cl_khr_d3d11_sharing extension
 is required for D3D11 to OpenCL mapping.
 [AVHWDeviceContext @ 0000020a9b2fc6c0] D3D11 to OpenCL mapping not usable.
 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'
 --------------------------------------------------------------------------------------------------------------
 "C:\SOFTWARE\ffmpeg\0-homebuilt-x64\ffmpeg.exe" -hide_banner -nostats -v
 verbose -init_hw_device opencl=ocl:0.0 -filter_hw_device ocl -i
 "D:\temp\SCRATCH\demo1.mpg" -map_metadata -1 -sws_flags
 lanczos+accurate_rnd+full_chroma_int+full_chroma_inp -filter_complex
 "[0:v]yadif=0:0:0,hwupload,unsharp_opencl=lx=3:ly=3:la=0.5:cx=3:cy=3:ca=0.5,hwdownload,format=pix_fmts=yuv420p,setdar=dar=16/9"
 -c:v h264_nvenc -pix_fmt nv12 -preset slow -bf 2 -g 50 -refs 3 -rc:v
 vbr_hq -rc-lookahead:v 32 -cq 22 -qmin 16 -qmax 25 -coder cabac -strict
 experimental -movflags +faststart+write_colr -profile:v high -level 5.1
 -af
 loudnorm=I=-16:TP=0.0:LRA=11:measured_I=-24.17:measured_LRA=7.30:measured_TP=-5.13:measured_thresh=-34.87:offset=-0.19:linear=true:print_format=summary
 -c:a libfdk_aac -cutoff 18000 -ab 384k -ar 48000  -y "T:\HDTV\autoTVS-
 mpg\Converted\demo1.aac.mp4"
 Routing option strict to both codec and muxer layer
 [AVHWDeviceContext @ 000001579131d740] 0.0: NVIDIA CUDA / GeForce RTX 2060
 SUPER
 [AVHWDeviceContext @ 000001579131d740] DXVA2 to OpenCL mapping function
 found (clCreateFromDX9MediaSurfaceKHR).
 [AVHWDeviceContext @ 000001579131d740] DXVA2 in OpenCL acquire function
 found (clEnqueueAcquireDX9MediaSurfacesKHR).
 [AVHWDeviceContext @ 000001579131d740] DXVA2 in OpenCL release function
 found (clEnqueueReleaseDX9MediaSurfacesKHR).
 [AVHWDeviceContext @ 000001579131d740] The cl_khr_d3d11_sharing extension
 is required for D3D11 to OpenCL mapping.
 [AVHWDeviceContext @ 000001579131d740] D3D11 to OpenCL mapping not usable.
 [mpeg @ 0000015791321940] max_analyze_duration 5000000 reached at 5000000
 microseconds st:0
 Input #0, mpeg, from 'D:\temp\SCRATCH\demo1.mpg':
   Duration: 00:44:49.53, start: 0.228244, bitrate: 3781 kb/s
     Stream #0:0[0x1e0]: Video: mpeg2video (Main), 1 reference frame,
 yuv420p(tv, bt470bg, top first, left), 720x576 [SAR 64:45 DAR 16:9], 25
 fps, 25 tbr, 90k tbn, 50 tbc
     Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 256 kb/s
 Stream mapping:
   Stream #0:0 (mpeg2video) -> yadif (graph 0)
   setdar (graph 0) -> Stream #0:0 (h264_nvenc)
   Stream #0:1 -> #0:1 (mp2 (native) -> aac (libfdk_aac))
 Press [q] to stop, [?] for help
 [graph 0 input from stream 0:0 @ 0000015791354600] w:720 h:576
 pixfmt:yuv420p tb:1/90000 fr:25/1 sar:64/45 sws_param:flags=2
 [auto_scaler_0 @ 00000157a33af180] w:iw h:ih flags:'bilinear' interl:0
 [format @ 00000157913549c0] auto-inserting filter 'auto_scaler_0' between
 the filter 'Parsed_setdar_5' and the filter 'format'
 [Parsed_setdar_5 @ 0000015791354340] w:720 h:576 dar:16/9 sar:64/45 ->
 dar:16/9 sar:64/45
 [auto_scaler_0 @ 00000157a33af180] w:720 h:576 fmt:yuv420p sar:64/45 ->
 w:720 h:576 fmt:nv12 sar:64/45 flags:0x2
 [h264_nvenc @ 00000157a2fb7700] Loaded Nvenc version 9.1
 [h264_nvenc @ 00000157a2fb7700] Nvenc initialized successfully
 [h264_nvenc @ 00000157a2fb7700] 1 CUDA capable devices found
 [h264_nvenc @ 00000157a2fb7700] [ GPU #0 - < GeForce RTX 2060 SUPER > has
 Compute SM 7.5 ]
 [h264_nvenc @ 00000157a2fb7700] supports NVENC
 [h264_nvenc @ 00000157a2fb7700] Lookahead enabled: depth 32, scenecut
 enabled, B-adapt enabled.
 [graph_1_in_0_1 @ 00000157a33afb80] tb:1/48000 samplefmt:s16p
 samplerate:48000 chlayout:0x3
 [Parsed_loudnorm_0 @ 00000157a33af680] auto-inserting filter
 'auto_resampler_0' between the filter 'graph_1_in_0_1' and the filter
 'Parsed_loudnorm_0'
 [format_out_0_1 @ 00000157a33ae080] auto-inserting filter
 'auto_resampler_1' between the filter 'Parsed_loudnorm_0' and the filter
 'format_out_0_1'
 [auto_resampler_0 @ 00000157a33aed80] ch:2 chl:stereo fmt:s16p r:48000Hz
 -> ch:2 chl:stereo fmt:dbl r:192000Hz
 [auto_resampler_1 @ 00000157a33ae480] ch:2 chl:stereo fmt:dbl r:192000Hz
 -> ch:2 chl:stereo fmt:s16 r:48000Hz
 Output #0, mp4, to 'T:\HDTV\autoTVS-mpg\Converted\demo1.aac.mp4':
   Metadata:
     encoder         : Lavf58.33.100
     Stream #0:0: Video: h264 (h264_nvenc) (High), 1 reference frame (avc1
 / 0x31637661), nv12(left), 720x576 [SAR 64:45 DAR 16:9], q=16-25, 2000
 kb/s, 25 fps, 12800 tbn, 25 tbc
     Metadata:
       encoder         : Lavc58.59.101 h264_nvenc
     Side data:
       cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000
 vbv_delay: N/A
     Stream #0:1: Audio: aac (libfdk_aac) (mp4a / 0x6134706D), 48000 Hz,
 stereo, s16, delay 2048, 384 kb/s
     Metadata:
       encoder         : Lavc58.59.101 libfdk_aac
 [mpeg2video @ 0000015791329b80] ac-tex damaged at 28 27
 [mpeg2video @ 0000015791329b80] Warning MVs not available
 [mpeg2video @ 0000015791329b80] concealing 90 DC, 90 AC, 90 MV errors in B
 frame
 D:\temp\SCRATCH\demo1.mpg: corrupt decoded frame in stream 0
 No more output streams to write to, finishing.
 [mp4 @ 0000015791358800] Starting second pass: moving the moov atom to the
 beginning of the file
 color primaries unspecified, assuming bt470bg
 [AVIOContext @ 0000015791323b80] Statistics: 810591228 bytes read, 0 seeks
 frame=67238 fps=283 q=24.0 Lsize=  792990kB time=00:44:49.44
 bitrate=2415.4kbits/s speed=11.3x
 video:665090kB audio:126067kB subtitle:0kB other streams:0kB global
 headers:0kB muxing overhead: 0.231687%
 Input file #0 (D:\temp\SCRATCH\demo1.mpg):
   Input stream #0:0 (video): 67238 packets read (1167445781 bytes); 67238
 frames decoded;
   Input stream #0:1 (audio): 112057 packets read (86059776 bytes); 112057
 frames decoded (129089664 samples);
   Total: 179295 packets (1253505557 bytes) demuxed
 Output file #0 (T:\HDTV\autoTVS-mpg\Converted\demo1.aac.mp4):
   Output stream #0:0 (video): 67238 frames encoded; 67238 packets muxed
 (681052519 bytes);
   Output stream #0:1 (audio): 126065 frames encoded (129089664 samples);
 126067 packets muxed (129092609 bytes);
   Total: 193305 packets (810145128 bytes) muxed
 [Parsed_loudnorm_0 @ 00000157a33af680]
 Input Integrated:    -24.2 LUFS
 Input True Peak:      -5.1 dBTP
 Input LRA:             7.3 LU
 Input Threshold:     -34.9 LUFS

 Output Integrated:   -16.0 LUFS
 Output True Peak:     +0.0 dBTP
 Output LRA:            7.0 LU
 Output Threshold:    -26.6 LUFS

 Normalization Type:   Dynamic
 Target Offset:        -0.0 LU
 [AVIOContext @ 00000157a2fa0500] Statistics: 30 seeks, 6209 writeouts
 [h264_nvenc @ 00000157a2fb7700] Nvenc unloaded
 [AVIOContext @ 000001579132b340] Statistics: 1273923728 bytes read, 2
 seeks
 --------------------------------------------------------------------------------------------------------------

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


More information about the FFmpeg-trac mailing list