Opened 8 months ago
Last modified 8 months ago
#10914 new defect
Access Violation using ddagrab filter in Windows x86 (32 bit)
Reported by: | Vadim Guchenko | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avfilter |
Version: | git-master | Keywords: | ddagrab x86 |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description (last modified by )
Summary of the bug:
I'm trying to record a video from Windows desktop using Desktop Duplication API (ddagrab filter). I cross-compiled ffmpeg 6.1.1 release for two Windows architectures - x86_64 and x86_32. All configuration options are same except the architecture. ddagrab filter works fine and records the video in ffmpeg compiled for x86_64, but it does not work in ffmpeg compiled for x86_32. No files are created. No errors are printed.
How to reproduce:
% ffmpeg -v 9 -loglevel 99 -filter_complex ddagrab,hwdownload,format=bgra -c:v libx264 output.mp4 ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 10-win32 (GCC) 20220113 configuration: --prefix=/ffmpeg --arch=x86_32 --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --x86asmexe=yasm --extra-ldflags='-static-libgcc -static -lwinpthread -dynamic' --enable-pic --disable-static --enable-shared --disable-debug --disable-doc --enable-gpl --enable-libx264 --disable-bzlib --disable-iconv --disable-lzma --disable-sdl2 --disable-securetransport --disable-xlib --disable-zlib libavutil 58. 29.100 / 58. 29.100 libavcodec 60. 31.102 / 60. 31.102 libavformat 60. 16.100 / 60. 16.100 libavdevice 60. 3.100 / 60. 3.100 libavfilter 9. 12.100 / 9. 12.100 libswscale 7. 5.100 / 7. 5.100 libswresample 4. 12.100 / 4. 12.100 libpostproc 57. 3.100 / 57. 3.100 Splitting the commandline. Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'. Reading option '-filter_complex' ... matched as option 'filter_complex' (create a complex filtergraph) with argument 'ddagrab,hwdownload,format=bgra'. Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'libx264'. Reading option 'output.mp4' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option v (set logging level) with argument 9. Applying option filter_complex (create a complex filtergraph) with argument ddagrab,hwdownload,format=bgra. [AVFilterGraph @ 011263c0] Setting 'pix_fmts' to value 'bgra' Successfully parsed a group of options. Parsing a group of options: output url output.mp4. Applying option c:v (codec name) with argument libx264. Successfully parsed a group of options. Opening an output file: output.mp4. [out#0/mp4 @ 011204c0] Creating output stream from unlabeled output of complex filtergraph 0. This overrides automatic video mapping. [vost#0:0/libx264 @ 01123800] Created video stream from complex filtergraph 0:[format:default] [vost#0:0/libx264 @ 01123800] [AVFilterGraph @ 0112a800] Setting 'pix_fmts' to value 'bgra' detected 20 logical cores [format @ 0112dbc0] Setting 'pix_fmts' to value 'yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16|nv21|yuv420p10le|yuv422p10le|yuv444p10le|nv20le|gray|gray10le' [auto_scale_0 @ 0112e240] w:iw h:ih flags:'' interl:0 [format @ 0112dbc0] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_format_2' and the filter 'format' [AVFilterGraph @ 0112a800] query_formats: 5 queried, 3 merged, 1 already done, 0 delayed [auto_scale_0 @ 0112e240] picking yuv444p out of 14 ref:bgra alpha:1 [Parsed_ddagrab_0 @ 0112af80] Created internal hw_device_ctx
This is all output.
Same command works in ffmpeg compiled for Windows x86_64:
% ffmpeg -v 9 -loglevel 99 -filter_complex ddagrab,hwdownload,format=bgra -c:v libx264 output.mp4 ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 10-win32 (GCC) 20220113 configuration: --prefix=/ffmpeg --arch=x86_64 --target-os=mingw64 --cross-prefix=x86_64-w64-mingw32- --x86asmexe=yasm --extra-ldflags='-static-libgcc -static -lwinpthread -dynamic' --enable-pic --disable-static --enable-shared --disable-debug --disable-doc --enable-gpl --enable-libx264 --disable-bzlib --disable-iconv --disable-lzma --disable-sdl2 --disable-securetransport --disable-xlib --disable-zlib libavutil 58. 29.100 / 58. 29.100 libavcodec 60. 31.102 / 60. 31.102 libavformat 60. 16.100 / 60. 16.100 libavdevice 60. 3.100 / 60. 3.100 libavfilter 9. 12.100 / 9. 12.100 libswscale 7. 5.100 / 7. 5.100 libswresample 4. 12.100 / 4. 12.100 libpostproc 57. 3.100 / 57. 3.100 Splitting the commandline. Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'. Reading option '-filter_complex' ... matched as option 'filter_complex' (create a complex filtergraph) with argument 'ddagrab,hwdownload,format=bgra'. Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'libx264'. Reading option 'output.mp4' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option v (set logging level) with argument 9. Applying option filter_complex (create a complex filtergraph) with argument ddagrab,hwdownload,format=bgra. [AVFilterGraph @ 0000023372409f00] Setting 'pix_fmts' to value 'bgra' Successfully parsed a group of options. Parsing a group of options: output url output.mp4. Applying option c:v (codec name) with argument libx264. Successfully parsed a group of options. Opening an output file: output.mp4. [out#0/mp4 @ 0000023372407ac0] Creating output stream from unlabeled output of complex filtergraph 0. This overrides automatic video mapping. [vost#0:0/libx264 @ 0000023372407000] Created video stream from complex filtergraph 0:[format:default] [vost#0:0/libx264 @ 0000023372407000] [AVFilterGraph @ 00000233724075c0] Setting 'pix_fmts' to value 'bgra' detected 20 logical cores [format @ 0000023373d21cc0] Setting 'pix_fmts' to value 'yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16|nv21|yuv420p10le|yuv422p10le|yuv444p10le|nv20le|gray|gray10le' [auto_scale_0 @ 0000023373d22980] w:iw h:ih flags:'' interl:0 [format @ 0000023373d21cc0] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_format_2' and the filter 'format' [AVFilterGraph @ 00000233724075c0] query_formats: 5 queried, 3 merged, 1 already done, 0 delayed [auto_scale_0 @ 0000023373d22980] picking yuv444p out of 14 ref:bgra alpha:1 [Parsed_ddagrab_0 @ 000002337240ed40] Created internal hw_device_ctx [Parsed_ddagrab_0 @ 000002337240ed40] Using IDXGIOutput5 interface [Parsed_ddagrab_0 @ 000002337240ed40] Opened dxgi output 0 with dimensions 1920x1080 [Parsed_ddagrab_0 @ 000002337240ed40] Updated pointer shape texture [Parsed_ddagrab_0 @ 000002337240ed40] Probed 8 bit RGB frame format [auto_scale_0 @ 0000023373d22980] w:1920 h:1080 fmt:bgra sar:1/1 -> w:1920 h:1080 fmt:yuv444p sar:1/1 flags:0x00000004 [out#0/mp4 @ 0000023372407ac0] No explicit maps, mapping streams automatically... [file @ 0000023300b2b8c0] Setting default whitelist 'file,crypto,data' Successfully opened the file. Stream mapping: format:default -> Stream #0:0 (libx264) Press [q] to stop, [?] for help [auto_scale_0 @ 0000023373d22980] w:1920 h:1080 fmt:bgra sar:1/1 -> w:1920 h:1080 fmt:yuv444p sar:1/1 flags:0x00000004 Last message repeated 2 times [libx264 @ 000002337240abc0] using mv_range_thread = 24 [libx264 @ 000002337240abc0] using SAR=1/1 [libx264 @ 000002337240abc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 000002337240abc0] profile High 4:4:4 Predictive, level 4.0, 4:4:4, 8-bit [libx264 @ 000002337240abc0] 264 - core 161 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=30 lookahead_threads=5 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'output.mp4': Metadata: encoder : Lavf60.16.100 Stream #0:0, 0, 1/15360: Video: h264, 1 reference frame (avc1 / 0x31637661), yuv444p(tv, unknown/bt709/iec61966-2-1, progressive), 1920x1080 (0x0) [SAR 1:1 DAR 16:9], 0/1, q=2-31, 30 fps, 15360 tbn Metadata: encoder : Lavc60.31.102 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A frame= 0 fps=0.0 q=0.0 size= 0kB time=N/A bitrate=N/A speed=N/A [Parsed_ddagrab_0 @ 000002337240ed40] Duplicated output frame [vost#0:0/libx264 @ 0000023372407000] Clipping frame in rate conversion by 0.130669 [Parsed_ddagrab_0 @ 000002337240ed40] Duplicated output frame Last message repeated 4 times ...
I execute both commands in Windows 11 x64.
Change History (8)
comment:1 by , 8 months ago
Component: | undetermined → avfilter |
---|
comment:2 by , 8 months ago
comment:3 by , 8 months ago
Version: | 6.1 → git-master |
---|
comment:4 by , 8 months ago
I checked the Windows Event Log and it turned out that the error (Access Violation) is there:
Faulting application name: ffmpeg.exe, version: 0.0.0.0, time stamp: 0x00000000 Faulting module name: avfilter-10.dll, version: 10.0.100.0, time stamp: 0x00000000 Exception code: 0xc0000005 Fault offset: 0x002b7635 Faulting process id: 0x0x1F68 Faulting application start time: 0x0x1DA7A6A6BCE0914 Faulting application path: C:\src\win-x86\lib\ffmpeg.exe Faulting module path: C:\src\win-x86\lib\avfilter-10.dll Report Id: 0efdfd4c-f757-4d60-a6a5-5e29ab7d59d8 Faulting package full name: Faulting package-relative application ID:
comment:5 by , 8 months ago
Using gdb for Windows:
... [format @ 00cbb380] Setting 'pix_fmts' to value 'yuv420p' [auto_scale_0 @ 04210f80] w:iw h:ih flags:'' interl:0 [format @ 00cbb380] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_format_2' and the filter 'format' [AVFilterGraph @ 04210a00] query_formats: 5 queried, 9 merged, 3 already done, 0 delayed [New Thread 32328.0x50f4] [New Thread 32328.0x6608] [Parsed_ddagrab_0 @ 04211480] Created internal hw_device_ctx Thread 6 received signal SIGSEGV, Segmentation fault. [Switching to Thread 32328.0x43cc] 0x0000002b in ?? ()
(gdb) bt #0 0x0000002b in ?? () #1 0x78aea420 in vertex_shader_input_layout () from C:\src\win-x86\lib\avfilter-10.dll #2 0x00cbb340 in ?? () Backtrace stopped: frame did not save the PC
(gdb) disass $pc-32,$pc+32 Dump of assembler code from 0xb to 0x4b: 0x0000000b: Cannot access memory at address 0xb
(gdb) info all-registers eax 0x42115b8 69277112 ecx 0x4211480 69276800 edx 0x57 87 ebx 0x80000022 -2147483614 esp 0x4211540 0x4211540 ebp 0x4211540 0x4211540 esi 0x1 1 edi 0x46cf014 74248212 eip 0x2b 0x2b eflags 0x76a4694c [ PF ZF TF OF NT AC ID ] cs 0x0 0 ss 0xc6ead0 13036240 ds 0x3cf000 3993600 es 0xc6fda0 13041056 fs 0xc6eaf0 13036272 gs 0x772f4770 1999587184 st0 <invalid float value> (raw 0x027f0000000078a47635) st1 2.41246595419045934145e-4946 (raw 0x00000000000000010286) st2 1.42719936927755029733e-4933 (raw 0x0000056efd1000000023) st3 1.42719936927755032649e-4933 (raw 0x0000056efd100000002b) st4 1.42719936927755032649e-4933 (raw 0x0000056efd100000002b) st5 1.42719936927755032649e-4933 (raw 0x0000056efd100000002b) st6 1.4271993692775504723e-4933 (raw 0x0000056efd1000000053) st7 1.42719936927755032649e-4933 (raw 0x0000056efd100000002b) fctrl 0x0 0 fstat 0x0 0 ftag 0x0 0 fiseg 0x0 0 fioff 0x0 0 foseg 0x0 0 fooff 0x0 0 fop 0x0 0 xmm0 {v4_float = {0x0, 0x0, 0xffffffff, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x7f, 0x2, 0x20, 0x1, 0x0, 0x0, 0x0, 0x0, 0x5f, 0x8e, 0xd0, 0x6c, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x27f, 0x120, 0x0, 0x0, 0x8e5f, 0x6cd0, 0x0, 0x0}, v4_int32 = {0x120027f, 0x0, 0x6cd08e5f, 0x0}, v2_int64 = {0x120027f, 0x6cd08e5f}, uint128 = 0x6cd08e5f000000000120027f} xmm1 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x20, 0x1, 0x0, 0x0, 0x0, 0x0, 0x5f, 0x8e, 0xd0, 0x6c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x120, 0x0, 0x0, 0x8e5f, 0x6cd0, 0x0, 0x0, 0x0}, v4_int32 = {0x120, 0x8e5f0000, 0x6cd0, 0x0}, v2_int64 = {0x8e5f000000000120, 0x6cd0}, uint128 = 0x6cd08e5f000000000120} xmm2 {v4_float = {0x0, 0xffffffff, 0x0, 0x0}, v2_double = {0x7fffffffffffffff, 0x0}, v16_int8 = {0x0, 0x0, 0x0, 0x0, 0x5f, 0x8e, 0xd0, 0x6c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x0, 0x0, 0x8e5f, 0x6cd0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x6cd08e5f, 0x0, 0x0}, v2_int64 = {0x6cd08e5f00000000, 0x0}, uint128 = 0x6cd08e5f00000000} xmm3 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 12 times>, 0xa0, 0x1f, 0x0, 0x0}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1fa0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x1fa0}, v2_int64 = {0x0, 0x1fa000000000}, uint128 = 0x1fa0000000000000000000000000} xmm4 {v4_float = {0xffffffff, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x5f, 0x8e, 0xd0, 0x6c, 0x0 <repeats 12 times>}, v8_int16 = {0x8e5f, 0x6cd0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x6cd08e5f, 0x0, 0x0, 0x0}, v2_int64 = {0x6cd08e5f, 0x0}, uint128 = 0x6cd08e5f} xmm5 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0, 0x0, 0x0, 0x0, 0xa0, 0x1f, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x0, 0x0, 0x1fa0, 0x0, 0xffff, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x1fa0, 0xffff, 0x0}, v2_int64 = {0x1fa000000000, 0xffff}, uint128 = 0xffff00001fa000000000} xmm6 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa0, 0x1f, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x1fa0, 0x0, 0xffff, 0x0}, v4_int32 = {0x0, 0x0, 0x1fa0, 0xffff}, v2_int64 = {0x0, 0xffff00001fa0}, uint128 = 0xffff00001fa00000000000000000} xmm7 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 12 times>, 0xa0, 0x1f, 0x0, 0x0}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1fa0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x1fa0}, v2_int64 = {0x0, 0x1fa000000000}, uint128 = 0x1fa0000000000000000000000000} mxcsr 0x0 [ ] mm0 {uint64 = 0x78a47635, v2_int32 = {0x78a47635, 0x0}, v4_int16 = {0x7635, 0x78a4, 0x0, 0x0}, v8_int8 = {0x35, 0x76, 0xa4, 0x78, 0x0, 0x0, 0x0, 0x0}} mm1 {uint64 = 0x10286, v2_int32 = {0x10286, 0x0}, v4_int16 = {0x286, 0x1, 0x0, 0x0}, v8_int8 = {0x86, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0}} mm2 {uint64 = 0x56efd1000000023, v2_int32 = {0x23, 0x56efd10}, v4_int16 = {0x23, 0x0, 0xfd10, 0x56e}, v8_int8 = {0x23, 0x0, 0x0, 0x0, 0x10, 0xfd, 0x6e, 0x5}} mm3 {uint64 = 0x56efd100000002b, v2_int32 = {0x2b, 0x56efd10}, v4_int16 = {0x2b, 0x0, 0xfd10, 0x56e}, v8_int8 = {0x2b, 0x0, 0x0, 0x0, 0x10, 0xfd, 0x6e, 0x5}} mm4 {uint64 = 0x56efd100000002b, v2_int32 = {0x2b, 0x56efd10}, v4_int16 = {0x2b, 0x0, 0xfd10, 0x56e}, v8_int8 = {0x2b, 0x0, 0x0, 0x0, 0x10, 0xfd, 0x6e, 0x5}} mm5 {uint64 = 0x56efd100000002b, v2_int32 = {0x2b, 0x56efd10}, v4_int16 = {0x2b, 0x0, 0xfd10, 0x56e}, v8_int8 = {0x2b, 0x0, 0x0, 0x0, 0x10, 0xfd, 0x6e, 0x5}} mm6 {uint64 = 0x56efd1000000053, v2_int32 = {0x53, 0x56efd10}, v4_int16 = {0x53, 0x0, 0xfd10, 0x56e}, v8_int8 = {0x53, 0x0, 0x0, 0x0, 0x10, 0xfd, 0x6e, 0x5}} mm7 {uint64 = 0x56efd100000002b, v2_int32 = {0x2b, 0x56efd10}, v4_int16 = {0x2b, 0x0, 0xfd10, 0x56e}, v8_int8 = {0x2b, 0x0, 0x0, 0x0, 0x10, 0xfd, 0x6e, 0x5}}
comment:6 by , 8 months ago
Summary: | ddagrab filter is not working in ffmpeg 6.1.1 cross-compiled for Windows x86_32 → Access Violation using ddagrab filter in Windows x86 (32 bit) |
---|
comment:7 by , 8 months ago
Description: | modified (diff) |
---|
comment:8 by , 8 months ago
The following patch fixes the problem:
diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -178,7 +178,7 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx) #if HAVE_IDXGIOUTPUT5 && HAVE_DPI_AWARENESS_CONTEXT IDXGIOutput5 *dxgi_output5 = NULL; - typedef DPI_AWARENESS_CONTEXT (*set_thread_dpi_t)(DPI_AWARENESS_CONTEXT); + typedef DPI_AWARENESS_CONTEXT (__stdcall *set_thread_dpi_t)(DPI_AWARENESS_CONTEXT); set_thread_dpi_t set_thread_dpi; HMODULE user32_module; #endif
I tried the latest ffmpeg from the master branch and the issue is still there: