From 984d10caff805ebd2018e699e5f41e634aa7dd16 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 22 Apr 2024 10:41:51 +0200 Subject: Show flatpak run command in help menu --- TODO | 4 +++- src/main.cpp | 15 ++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 6b7f9b8..5211e9f 100644 --- a/TODO +++ b/TODO @@ -118,4 +118,6 @@ Support drm plane rotation. Neither X11 nor any Wayland compositor currently rot Investigate if there is a way to do gpu->gpu copy directly without touching system ram to enable video encoding on a different gpu. On nvidia this is possible with cudaMemcpyPeer, but how about from an intel/amd gpu to an nvidia gpu or the other way around or any combination of iGPU and dedicated GPU? Maybe something with clEnqueueMigrateMemObjects? on AMD something with DirectGMA maybe? -Fix opus/flac ( variable framerate audio :( ). +Fix opus/flac ( variable framerate audio :( ). Going back to constant framerate audio should fix the issue with skipped frames when recording for some people (issue only reproducable with pulseaudio, and only for some users?). + +Go back to using pure vaapi without opengl for video encoding? rotation (transpose) can be done if its done after (rgb to yuv) color conversion. diff --git a/src/main.cpp b/src/main.cpp index 434b494..98740c3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -808,10 +808,14 @@ static void open_video(AVCodecContext *codec_context, VideoQuality video_quality } static void usage_header() { - fprintf(stderr, "usage: gpu-screen-recorder -w [-c ] [-s WxH] -f [-a ] [-q ] [-r ] [-k h264|hevc|hevc_hdr|av1|av1_hdr] [-ac aac|opus|flac] [-ab ] [-oc yes|no] [-fm cfr|vfr] [-cr limited|full] [-v yes|no] [-h|--help] [-o ] [-mf yes|no] [-sc ] [-cursor yes|no]\n"); + const bool inside_flatpak = getenv("FLATPAK_ID") != NULL; + const char *program_name = inside_flatpak ? "flatpak run --command=gpu-screen-recorder com.dec05eba.gpu_screen_recorder" : "gpu-screen-recorder"; + fprintf(stderr, "usage: %s -w [-c ] [-s WxH] -f [-a ] [-q ] [-r ] [-k h264|hevc|hevc_hdr|av1|av1_hdr] [-ac aac|opus|flac] [-ab ] [-oc yes|no] [-fm cfr|vfr] [-cr limited|full] [-v yes|no] [-h|--help] [-o ] [-mf yes|no] [-sc ] [-cursor yes|no]\n", program_name); } static void usage_full() { + const bool inside_flatpak = getenv("FLATPAK_ID") != NULL; + const char *program_name = inside_flatpak ? "flatpak run --command=gpu-screen-recorder com.dec05eba.gpu_screen_recorder" : "gpu-screen-recorder"; usage_header(); fprintf(stderr, "\n"); fprintf(stderr, "OPTIONS:\n"); @@ -890,9 +894,9 @@ static void usage_full() { fprintf(stderr, " Send signal SIGUSR2 to gpu-screen-recorder (killall -SIGUSR2 gpu-screen-recorder) to pause/unpause recording. Only applicable and useful when recording (not streaming nor replay).\n"); fprintf(stderr, "\n"); fprintf(stderr, "EXAMPLES:\n"); - fprintf(stderr, " gpu-screen-recorder -w screen -f 60 -a \"$(pactl get-default-sink).monitor\" -o \"$HOME/Videos/video.mp4\"\n"); - fprintf(stderr, " gpu-screen-recorder -w screen -f 60 -a \"$(pactl get-default-sink).monitor|$(pactl get-default-source)\" -o \"$HOME/Videos/video.mp4\"\n"); - fprintf(stderr, " gpu-screen-recorder -w screen -f 60 -a \"$(pactl get-default-sink).monitor\" -c mkv -r 60 -o \"$HOME/Videos\"\n"); + fprintf(stderr, " %s -w screen -f 60 -a \"$(pactl get-default-sink).monitor\" -o \"$HOME/Videos/video.mp4\"\n", program_name); + fprintf(stderr, " %s -w screen -f 60 -a \"$(pactl get-default-sink).monitor|$(pactl get-default-source)\" -o \"$HOME/Videos/video.mp4\"\n", program_name); + fprintf(stderr, " %s -w screen -f 60 -a \"$(pactl get-default-sink).monitor\" -c mkv -r 60 -o \"$HOME/Videos\"\n", program_name); //fprintf(stderr, " gpu-screen-recorder -w screen -f 60 -q ultra -pixfmt yuv444 -o video.mp4\n"); _exit(1); } @@ -2421,7 +2425,8 @@ int main(int argc, char **argv) { int sound_buffer_size = -1; //const double time_before_read_seconds = clock_get_monotonic_seconds(); if(audio_device.sound_device.handle) { - // TODO: use this instead of calculating time to read. But this can fluctuate and we dont want to go back in time + // TODO: use this instead of calculating time to read. But this can fluctuate and we dont want to go back in time, + // also it's 0.0 for some users??? double latency_seconds = 0.0; sound_buffer_size = sound_device_read_next_chunk(&audio_device.sound_device, &sound_buffer, timeout_sec, &latency_seconds); } -- cgit v1.2.3