Commit Graph

265 Commits

Author SHA1 Message Date
dec05eba
b6227c07f2 Use x11 event loop with XPending instead of XCheckTypedWindowEvent 2023-04-21 20:23:11 +02:00
dec05eba
690065da0f Only capture frame if num frames to capture > 0 2023-04-18 22:31:44 +02:00
dec05eba
03ef7d0964 Show shorter form of help on argument error 2023-04-18 18:41:06 +02:00
dec05eba
7749ba8327 Replace tabs with 4 spaces 2023-04-18 18:34:23 +02:00
XnipS
e985e8e18e Made fps update toggleable 2023-04-18 18:32:04 +02:00
dec05eba
c0ebae365d Find /dev/dri/card path that exists (the first one) 2023-04-16 22:50:43 +02:00
dec05eba
d953d0bb36 Use XDG_RUNTIME_DIR (and flatpak specific dir) and /dev/dri/renderD128 instead of /dev/dri/card0 (fixes capture on some systems) 2023-04-16 22:05:09 +02:00
dec05eba
c510bc5ae5 Remove extra swapBuffer in kms capture 2023-04-15 20:39:02 +02:00
dec05eba
c9c615d4c7 Apply rotation fix for intel as well (for kms capture) 2023-04-15 19:41:49 +02:00
dec05eba
f6107a0c5d Fix AMD single monitor rotated display being rotated in recording
If there is only one monitor connected and it's rotated then
the drm buf will also be rotated. This only the case with AMD and
only when using one monitor!

To fix this, we perform color conversion with an opengl shader
which allows us to also rotate the texture.
VAAPI supports rotation but it's not implemented by AMD at least.

Performance seems to be the same as when using VAAPI, even when
GPU usage is 100%.
2023-04-15 19:06:08 +02:00
dec05eba
5c714ea714 Move EGL define to egl.h from window texture .c 2023-04-15 04:14:43 +02:00
dec05eba
45a64316b4 Move back receive packet to main thread
Fixes crash if encode fps is less than capture fps
2023-04-13 23:44:23 +02:00
dec05eba
7c4714956c Move back video encoding to main thread, move receive packet to separate thread
When video is encoded at slower than capture rate that would
cause a crash (happens on steam deck).
2023-04-13 03:12:53 +02:00
dec05eba
2fdc73ffab Temporary disable monitor recording on amd/intel 2023-04-11 00:48:59 +02:00
dec05eba
e7020376e9 Remove kms modifier 2023-04-11 00:29:12 +02:00
dec05eba
cc7cf8197e Revert "amd/intel: use xrgb format, use drm prime 2"
This reverts commit 2f665e9d53.
2023-04-11 00:27:34 +02:00
dec05eba
2f665e9d53 amd/intel: use xrgb format, use drm prime 2 2023-04-11 00:06:47 +02:00
dec05eba
b150acb66e amd test 2 2023-04-10 23:38:45 +02:00
dec05eba
32459991c0 Recreate surface every frame :( 2023-04-10 23:21:07 +02:00
dec05eba
6d75615e1d aaa 2023-04-10 23:03:52 +02:00
dec05eba
6f9d17fad5 Dont create va surface every frame for kms (test) 2023-04-10 22:50:41 +02:00
dec05eba
59046178c4 Remove unecessary vaCreatebuffer every frame 2023-04-10 22:46:56 +02:00
dec05eba
4996266f28 Amd monitor recording fixed, remove unused modifier code 2023-04-10 21:32:10 +02:00
dec05eba
b298129f3b test kms 2023-04-10 20:59:43 +02:00
dec05eba
2e74aad58b Debug amd kms err 2023-04-10 20:41:30 +02:00
dec05eba
c8e45e67bd Cleanup of aframe if same pts 2023-04-10 06:17:45 +02:00
dec05eba
f2ae6eb05e Fix messed up audio pts when merging audio 2023-04-10 06:13:24 +02:00
dec05eba
895768104f Revert "Revert: encoding video on separate thread"
This reverts commit ce9465b391.
2023-04-10 06:07:48 +02:00
dec05eba
ce9465b391 Revert: encoding video on separate thread 2023-04-10 04:44:29 +02:00
dec05eba
ce5e0169c4 kms: fix crash on intel when using hevc, remove debug print, remove jpeg color range (incorrect colors on intel h264) 2023-04-10 02:38:47 +02:00
dec05eba
dddd426904 kms: get plane every frame, might fix not updating issue and issue where plane gets invalid 2023-04-10 02:25:43 +02:00
dec05eba
7dcf3a68cc Use /usr/bin/gsr-kms-server constant path for pkexec 2023-04-09 16:06:39 +02:00
dec05eba
cb82677ae8 Move kms client and server to separate directories 2023-04-09 15:54:29 +02:00
dec05eba
e3702f147f Use flatpak-spawn in flatpak 2023-04-08 07:12:45 +02:00
dec05eba
d8d0e739e7 Only use flatpak-spawn if inside flatpak, use gsr-kms-server in PATH 2023-04-08 07:05:30 +02:00
dec05eba
bed3a2c681 test 2023-04-08 06:53:37 +02:00
dec05eba
5247787fcf pkexec test 2023-04-08 06:23:15 +02:00
dec05eba
be388cda5f kms permission ok if running as root, no pkexec needed 2023-04-08 05:50:43 +02:00
dec05eba
de72b93b0d Better amd/intel quality tuning 2023-04-08 02:03:50 +02:00
dec05eba
75ed160122 Implement kms vaapi capture 2023-04-07 05:31:46 +02:00
dec05eba
10d7bf93e8 Cleanup replay packets after use 2023-04-03 10:45:00 +02:00
dec05eba
711379899b Fix -k description 2023-04-02 15:36:59 +02:00
dec05eba
cc63bffaf7 Dont initialize vaapi on nvidia (fixes crash on startup) 2023-04-01 23:24:12 +02:00
Steam Deck User
c720d38978 Rename drm to vaapi 2023-04-01 19:05:56 +02:00
Steam Deck User
29237c7116 Cleanup xcomposite_drm 2023-04-01 19:01:20 +02:00
Steam Deck User
2f67083915 Use vaapi to do rgb->yuv420p color conversion
Enable window capture for amd/intel.
Properly check if h264/hevc is supported on amd/intel before using
codec.
2023-04-01 16:29:24 +02:00
dec05eba
162eac8c2f Xsync after overclock (and reset), dont set colorspace data 2023-04-01 13:48:59 +02:00
dec05eba
8c6e526318 Make sure region size for focused window is divisable by 2 2023-03-31 04:37:44 +02:00
dec05eba
82e3720084 Install coolbits if using nvidia, add preserve video memory install script 2023-03-31 01:11:12 +02:00
dec05eba
f57b641d6d Better usage formatting 2023-03-27 23:36:27 +02:00
dec05eba
bd925e0beb Add code for variable framerate 2023-03-26 20:54:08 +02:00
dec05eba
d92ecea69e Remove yuv444 for now 2023-03-26 19:04:51 +02:00
dec05eba
5d80bd886c Move video encoding to separate thread, remove pixel_format that doesn't do anything and was bugged 2023-03-26 19:04:51 +02:00
dec05eba
716cb5b448 Add pixfmt yuv420p/yuv444p option to set lossless color 2023-03-26 19:04:51 +02:00
dec05eba
f3c24b3c8b Remove unused and invalid flags 2023-03-26 19:04:51 +02:00
dec05eba
d4b8833fdd Remove unused code 2023-03-26 19:04:51 +02:00
dec05eba
8592a46929 Do not automatically install coolbits because if used on amd/intel then xorg wont boot 2023-03-24 02:00:38 +01:00
dec05eba
78398f9bdd Add error message if using wayland (without xwayland) or xwayland 2023-03-21 22:28:52 +01:00
dec05eba
5107d24541 Update readme 2023-03-17 18:32:24 +01:00
dec05eba
93cb6593a6 Add overclocking option -oc to workaround a NVIDIA driver bug (forcefully set to p2 state when using cuda) 2023-03-17 17:17:14 +01:00
Steam Deck User
8cbdb596eb vaapi wip 2023-03-17 11:44:51 +01:00
dec05eba
689419a782 Fix for ffmpeg 6 (nvenc hevc doesn't support b frames) 2023-03-10 10:16:09 +01:00
dec05eba
8ca1ac70e8 Support opus flt and fltp 2023-03-04 16:02:48 +01:00
dec05eba
c956cd4be3 dd 2023-03-04 15:42:53 +01:00
dec05eba
7a4ab93dc3 exp 2023-03-04 15:32:32 +01:00
dec05eba
06311eac36 Enable experimental support to make sure opus/flac works on older ffmpeg versions 2023-03-04 14:59:55 +01:00
dec05eba
4ff9a47b3d Improve usage doc for -ac 2023-03-04 13:08:31 +01:00
dec05eba
3413f193c1 Add opus/flac audio options (only supported my mp4/mkv) 2023-03-04 12:57:30 +01:00
dec05eba
74a5fb9dfb Add screen-direct-force option for VRR monitor 2023-03-04 11:19:31 +01:00
dec05eba
fdcdfd2b35 Fix broken video because of broken audio, most noticably in replay 2023-02-22 09:45:06 +01:00
dec05eba
e9b4f66e37 Fix follow focused for the first window and when switching from/to invalid window 2023-02-19 15:56:44 +01:00
dec05eba
1d8d95fba4 Add option to merge audio devices by separating audio inputs with | in one -a 2023-02-16 23:40:21 +01:00
dec05eba
a17e8a1a77 Fix crash on error: dont do av_buffer_unref on frame contex because device_ctx frees it as well 2023-01-18 13:26:25 +01:00
dec05eba
bf6fbea736 Add info about audio names to readme file 2023-01-07 00:43:19 +01:00
dec05eba
5948233a0f mm 2023-01-01 19:16:18 +01:00
dec05eba
fcb8f24754 Merge code fix 2022-12-20 15:53:02 +01:00
dec05eba
8d30a205b1 Make -c optional, select container format from file extension by default 2022-12-20 15:43:46 +01:00
dec05eba
bcd8117c76 Better audio/video sync, disable broken screen-direct again (nvidia driver bug) 2022-12-20 15:42:27 +01:00
dec05eba
3aa4f3e9f5 Re-enable screen-direct, disable h264 forced fallback and use p6 again 2022-12-20 15:42:25 +01:00
dec05eba
9d0d02ff6f Attempt to reduce stuttering of video 2022-12-20 15:41:24 +01:00
dec05eba
4e6fc174fe follow focused 2022-12-20 15:32:42 +01:00
dec05eba
6a6bb703bc wip intel 2022-11-30 19:36:33 +01:00
dec05eba
a7e0dbd833 Refactor xcomposite into abstract capture api
Refactor c++ files into c files, more usable
2022-10-16 04:15:09 +02:00
dec05eba
93d46b9767 Refactor nvfbc into abstract capture api 2022-10-14 01:22:43 +02:00
dec05eba
2a788b5533 Use medium instead of p4 and slow instead of p7 for old ffmpeg 2022-10-12 14:24:13 +02:00
dec05eba
dc20d1eddb Do not use p4, p7 with old ffmpeg that doesn't have those options yet 2022-10-12 04:53:56 +02:00
dec05eba
9d185f3091 Use p4 preset on older gpus (kepler family) because of performance
with p7
2022-10-11 19:47:28 +02:00
dec05eba
1ca4dcfbdb Tune quality again, remove vbr 2022-10-11 02:47:17 +02:00
dec05eba
1a4e0aff72 Better tune quality options for different resolutions 2022-10-08 10:13:59 +02:00
dec05eba
88d06478d3 Fix crash caused by invalid memory write when recording audio
In some scenarios memcpy can write to 8 bytes (or more?) over the buffer
end.

Thanks to Guilherme for reporting the issue and testing the fix.
2022-10-07 03:44:54 +02:00
dec05eba
92f4b1a6f1 Fix copy paste mistake possible crash (using av_opt_set instead of av_dict_set)
Thanks @guihkx
2022-10-06 21:54:44 +02:00
dec05eba
ea8254e115 Fix possible pulseaudio crash? 2022-10-05 12:47:34 +02:00
dec05eba
e8b16e8347 Live stream: set gop to fps*2, bit rate for medium to lower value 2022-10-04 02:44:46 +02:00
dec05eba
f55b713437 Temporary disable screen-direct recording as it causes stuttering (nvfbc bug?) 2022-10-04 02:23:40 +02:00
dec05eba
e80d7676d4 Livestream: add silent audio track if not audio input is provided (fixes youtube and other sites) 2022-10-04 01:32:27 +02:00
dec05eba
c354d88583 Add medium and high quality, better livestreaming options, fix global header (especially for streaming) 2022-10-04 00:09:53 +02:00
dec05eba
4cd391e07e Add info about flatpak package, default to h264 (unless resolution is greater than 3840x2160) and add -k option to set codec 2022-10-03 16:56:58 +02:00
dec05eba
9ff0bb199b Revert gop size 2022-10-03 01:55:39 +02:00
dec05eba
0ec31db6c6 Do not set keyint min 2022-10-02 23:08:07 +02:00
dec05eba
6885d1a30e Sacrifice seek speed for reduced file size 2022-10-02 22:19:54 +02:00