Changing recording per-window
So, I've got an ultrawide and it's a little bit silly that my entire monitor is captured when I might only want a little bit of it.
Is there any way using the pre and post recording commands that I could essentially change the area to record to be on the currently focused window? Then, if I change windows, I stop recording and start a new buffer with the new window? I'd most likely be using this when playing games (when my mouse isn't switching windows) so that would make sense for me?
This is an amazing tool by the way - its making me get excited!
There are currently options to specify the area to record if the window with the game is always in the same spot. The idea of keeping track of the currently focused window is definitely an interesting idea but a difficult one, will add it to the todo list and one day I might get around to it.
I'm sure people would be able to do this themselves if you exposed a function or something to allow us to change the area being recorded? You wouldn't have to keep track of it yourself, I'm sure we could write our own way of doing it (kind of like how you can draw rectangles for taking screenshots because it's just going off of what's passed in).
I use bspwn, I'm sure there must be a way of doing something whenever the currently focused window changes although don't quote me. Either way, this is a very painless way of recording and I can see people enjoying hacking scripts together to extend its uses. Perhaps start-stop functionality etc. I don't know, not my place to suggest stuff, just wanted to ask about the possibility of making it easier to set up what's being recorded. Some people might prefer it if the area being recorded followed the mouse continuously, or if the area was locked to a specific window when a keybinding is pressed. You know better than me what this is capable of!
Good luck 😊 I am going to use this anyway but just thought I'd ask if there was any way to do any of this!
On Mon, 9 Nov 2020, at 9:46 PM, matanui159 wrote:
There are currently options to specify the area to record if the window with the game is always in the same spot. The idea of keeping track of the currently focused windows is definitely an interesting idea but a difficult one, will add it to the todo list and one day I might get around to it.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/matanui159/ReplaySorcery/issues/53#issuecomment-724297330, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACEGULIAVJ5QWZVTLAGTL5DSPBPL5ANCNFSM4TP3PQNQ.
Ashley Smith https://aas.sh
The problem is with the (almost finished) rewrite:
- with how FFmpeg is setup, you can't change the grab area for X11 without destroying and recreating the input stream. This may still be possible since I am thinking of doing this anyway for the
kmsgrabstream when it starts failing. - video is already encoded and just packaged together when saved, cropping would require decoding and encoding again
FFmpeg does have an option to follow the mouse however, so I might add an option to expose that but it would only work with the X11 backend and not support hardware encoding. Maybe I might have a setting for backend-specific options.
It is technically possible just a bit difficult
It seems like there's no point in keeping the old context when changing the position and size of the capture window. It could be just a complete restart. You just need to get the new size and position to capture and feed it to replay-sorcery.
You can run this command xdotool getwindowfocus getwindowgeometry which will print out the position and size of the currently focused window. For example:
$ xdotool getwindowfocus getwindowgeometry
Window 138412034
Position: 452,111 (screen: 0)
Geometry: 1155x387
This can be send to replay-sorcery via a socket or by writing to its stdin /proc/pid-of-replay-sorcery/fd/0 or to any other FD.
Or, actually, replay-sorcery can call this script itself and get the result right away, some pseudo code
//this function is on some hotkey
get_new_window_capture() {
destroyPreviousContext();
int x, y, w, h = 0;
char buff[0x100];
FILE* f = popen("'xdotool getwindowfocus getwindowgeometry'", "r");
if (!f) { printf("error\n"); }
fread(buff, 1, 0x100, f);
pclose(f);
//parse buff to get the x,y,w,h variables, put them in the config. Call init again
}
perhaps calling xdotool can be replaced with some xlib / xcb code