| | 58 | |
| | 59 | == Win10+ WinRT/UWP based Windows.Graphics.Capture == |
| | 60 | |
| | 61 | This filter uses the most recent API Microsoft added for capturing individual windows, but also entire monitors. |
| | 62 | It grabs the frames directly from the compositor, which allows it to capture windows that are partially or fully occluded. |
| | 63 | |
| | 64 | {{{ |
| | 65 | ffmpeg -filter_complex gfxcapture=window_title='(?i)My Application':max_framerate=60,hwdownload,format=bgra,format=yuv420p -c:v libx264 -crf 15 capture.mp4 |
| | 66 | }}} |
| | 67 | |
| | 68 | Since it outputs d3d11 hardware frames, you need to either download them like shown above, or pass them directly to a compatible hardware encoder, like nvenc or amf. |
| | 69 | |
| | 70 | {{{ |
| | 71 | ffmpeg -filter_complex gfxcapture=monitor_idx=1:width=1920:height=1080:resize_mode=scale_aspect:output_fmt=10bit -c:v hevc_nvenc -cq 15 capture.mp4 |
| | 72 | }}} |
| | 73 | |
| | 74 | This filter returns frames at the rate they come in from the native API, with timestamps directly from the compositor. |
| | 75 | As a result of this, it produces highly variable frame rate (VFR) output, which in extreme cases can be 0 FPS for extended periods of time. |
| | 76 | If you need a stable frame rate, add an FPS filter after it: |
| | 77 | |
| | 78 | {{{ |
| | 79 | ffmpeg -filter_complex gfxcapture=window_exe='^firefox.exe$':display_border=1:scale_mode=point:max_framerate=60,fps=60 -rc qvbr -qvbr_quality_level 15 -c:v h264_amf capture.mp4 |
| | 80 | }}} |
| | 81 | |
| | 82 | For a full list of options, check the documentation of the gfxcapture filter: [https://ffmpeg.org/ffmpeg-filters.html#gfxcapture] |