Add interactive record script
This commit is contained in:
parent
4418871737
commit
f9e99e57f9
@ -11,7 +11,7 @@ When recording a 4k game, fps drops from 30 to 7 when using OBS Studio, however
|
|||||||
the fps remains at 30.
|
the fps remains at 30.
|
||||||
|
|
||||||
# Example
|
# Example
|
||||||
`gpu-screen-recorder -w 0x1c00001 -c mp4 -f 60 -a bluez_sink.00_18_09_8A_07_93.a2dp_sink.monitor > test_video.mp4`
|
Run `interactive.sh` or run `gpu-screen-recorder -w 0x1c00001 -c mp4 -f 60 -a bluez_sink.00_18_09_8A_07_93.a2dp_sink.monitor > test_video.mp4`
|
||||||
|
|
||||||
# Demo
|
# Demo
|
||||||
[![Click here to watch a demo video on youtube](https://img.youtube.com/vi/n5tm0g01n6A/0.jpg)](https://www.youtube.com/watch?v=n5tm0g01n6A)
|
[![Click here to watch a demo video on youtube](https://img.youtube.com/vi/n5tm0g01n6A/0.jpg)](https://www.youtube.com/watch?v=n5tm0g01n6A)
|
||||||
|
30
interactive.sh
Executable file
30
interactive.sh
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
print_selected_window_id() {
|
||||||
|
xwininfo | grep 'Window id:' | cut -d' ' -f4
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Select a window to record"
|
||||||
|
window_id=$(print_selected_window_id)
|
||||||
|
|
||||||
|
echo -n "Enter video fps: "
|
||||||
|
read fps
|
||||||
|
|
||||||
|
echo "Select audio input:"
|
||||||
|
selected_audio_input=""
|
||||||
|
select audio_input in $(pactl list | sed -rn 's/Monitor Source: (.*)/\1/p'); do
|
||||||
|
if [ "$audio_input" == "" ]; then
|
||||||
|
echo "Invalid option $REPLY"
|
||||||
|
else
|
||||||
|
selected_audio_input="$audio_input"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -n "Enter output file name: "
|
||||||
|
read output_file_name
|
||||||
|
|
||||||
|
output_dir=$(dirname "$output_file_name")
|
||||||
|
mkdir -p "$output_dir"
|
||||||
|
|
||||||
|
sibs build --release && ./sibs-build/linux_x86_64/release/gpu-screen-recorder -w "$window_id" -c mp4 -f "$fps" -a "$selected_audio_input" > "$output_file_name"
|
12
src/main.cpp
12
src/main.cpp
@ -743,7 +743,7 @@ int main(int argc, char **argv) {
|
|||||||
double start_time = glfwGetTime();
|
double start_time = glfwGetTime();
|
||||||
double frame_timer_start = start_time;
|
double frame_timer_start = start_time;
|
||||||
double window_resize_timer = start_time;
|
double window_resize_timer = start_time;
|
||||||
bool window_resized = true;
|
bool window_resized = false;
|
||||||
int fps_counter = 0;
|
int fps_counter = 0;
|
||||||
int current_fps = 30;
|
int current_fps = 30;
|
||||||
|
|
||||||
@ -841,7 +841,7 @@ int main(int argc, char **argv) {
|
|||||||
window_width = e.xconfigure.width;
|
window_width = e.xconfigure.width;
|
||||||
window_height = e.xconfigure.height;
|
window_height = e.xconfigure.height;
|
||||||
window_resize_timer = glfwGetTime();
|
window_resize_timer = glfwGetTime();
|
||||||
window_resized = false;
|
window_resized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -894,13 +894,13 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const double window_resize_timeout = 1.0; // 1 second
|
const double window_resize_timeout = 1.0; // 1 second
|
||||||
if(!window_resized && time_now - window_resize_timer >= window_resize_timeout) {
|
if(window_resized && time_now - window_resize_timer >= window_resize_timeout) {
|
||||||
window_resized = true;
|
window_resized = false;
|
||||||
fprintf(stderr, "Resize window!\n");
|
fprintf(stderr, "Resize window!\n");
|
||||||
recreate_window_pixmap(dpy, src_window_id, window_pixmap);
|
recreate_window_pixmap(dpy, src_window_id, window_pixmap);
|
||||||
// Resolution must be a multiple of two
|
// Resolution must be a multiple of two
|
||||||
video_stream->codec->width = window_pixmap.texture_width & ~1;
|
//video_stream->codec->width = window_pixmap.texture_width & ~1;
|
||||||
video_stream->codec->height = window_pixmap.texture_height & ~1;
|
//video_stream->codec->height = window_pixmap.texture_height & ~1;
|
||||||
|
|
||||||
cuGraphicsUnregisterResource(cuda_graphics_resource);
|
cuGraphicsUnregisterResource(cuda_graphics_resource);
|
||||||
res = cuGraphicsGLRegisterImage(
|
res = cuGraphicsGLRegisterImage(
|
||||||
|
Loading…
Reference in New Issue
Block a user