Opened 3 years ago

Last modified 13 months ago

#10385 new defect

ddagrab fails on Windows if adapter ID is specified

Reported by: Jøger Hansegård Owned by:
Priority: normal Component: undetermined
Version: 6.0 Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Screen capturing on Windows with ddagrab fails if adapter id is specified on non-UWP build. Root cause is likely that CreateDXGIFactory is used, not CreateDXGIFactory1. Desktop duplication API appears to be incompatible with DXGI factories prior to 1.1.

See also https://learn.microsoft.com/en-us/windows/win32/api/dxgi1_2/nf-dxgi1_2-idxgioutput1-duplicateoutput which specifies that IDXGIOutput1::DuplicateOutput fails with E_INVALIDARG if the device was not created from IDXGIFactory1 (or a later version of a DXGI factory interface that inherits from IDXGIFactory1).

How to reproduce:

ffmpeg -init_hw_device d3d11va:0 -filter_complex ddagrab -c:v h264_nvenc -cq:v 20 output.mkv -loglevel debug

ffmpeg version 6.0
built on Windows, MSYS2

Change History (1)

comment:1 by Sergey Svistunov, 13 months ago

I have this error on ffmpeg 6.1.1 when trying to use ddagrab to record a non-primary display on my laptop with hybrid graphics (Intel + NVidia).

Seems to be fixed in ffmpeg 7.1.1.

ffmpeg 6.1.1:

ffmpeg -hide_banner -init_hw_device d3d11va:0 -thread_queue_size 1024 -rtbufsize 256M -filter_complex ddagrab=framerate=30:draw_mouse=0:output_idx=0,hwdownload,format=bgra -vcodec libx264 -b:v 3400k -r 30 -pix_fmt yuv420p -preset fast -movflags +faststart "test.mp4"

[AVHWDeviceContext @ 0000019549cefec0] Using device 10de:2191 (NVIDIA GeForce GTX 1660 Ti).
[Parsed_ddagrab_0 @ 0000019549cf7980] Invalid output duplication argument
[Parsed_ddagrab_0 @ 0000019549cf7980] Failed to configure output pad on Parsed_ddagrab_0
[fc#0 @ 0000019549ced500] Error configuring filter graph: Invalid argument
Error opening output file test.mp4.
Error opening output files: Invalid argument
ffmpeg -hide_banner -init_hw_device d3d11va:1 -thread_queue_size 1024 -rtbufsize 256M -filter_complex ddagrab=framerate=30:draw_mouse=0:output_idx=0,hwdownload,format=bgra -vcodec libx264 -b:v 3400k -r 30 -pix_fmt yuv420p -preset fast -movflags +faststart "test.mp4"

[AVHWDeviceContext @ 00000177ed590240] Using device 8086:9bc4 (Intel(R) UHD Graphics).
[Parsed_ddagrab_0 @ 00000177ed597d00] Invalid output duplication argument
[Parsed_ddagrab_0 @ 00000177ed597d00] Failed to configure output pad on Parsed_ddagrab_0
[fc#0 @ 00000177ed590500] Error configuring filter graph: Invalid argument
Error opening output file test.mp4.
Error opening output files: Invalid argument
Note: See TracTickets for help on using tickets.