mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-04-19 16:35:47 +09:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
716dc0b736 | ||
|
|
059e3dbbc0 | ||
|
|
990dfc7589 | ||
|
|
2d551e7b1f | ||
|
|
72c548c19e | ||
|
|
7123081e53 | ||
|
|
eba5f3f43d |
@@ -240,3 +240,5 @@ then GPU Screen Recorder will automatically use that same GPU for recording and
|
|||||||
This is a bug in kde plasma wayland. When using desktop portal capture and the monitor is rotated and a window is made fullscreen kde plasma wayland will give incorrect rotation to GPU Screen Recorder.
|
This is a bug in kde plasma wayland. When using desktop portal capture and the monitor is rotated and a window is made fullscreen kde plasma wayland will give incorrect rotation to GPU Screen Recorder.
|
||||||
This also affects other screen recording software such as obs studio.\
|
This also affects other screen recording software such as obs studio.\
|
||||||
Capture a monitor directly instead to workaround this issue until kde plasma devs fix it, or use another wayland compositor that doesn't have this issue.
|
Capture a monitor directly instead to workaround this issue until kde plasma devs fix it, or use another wayland compositor that doesn't have this issue.
|
||||||
|
## System notifications get disabled when recording with desktop portal option
|
||||||
|
Some desktop environments such as KDE Plasma turn off notifications when you record the screen with the desktop portal option. You can disable this by going into KDE Plasma settings -> search for notifications and then under "Do Not Disturb mode" untick "During screen sharing".
|
||||||
|
|||||||
14
TODO
14
TODO
@@ -195,8 +195,6 @@ Always disable prime run/dri prime and list all monitors to record from from all
|
|||||||
Allow flv av1 if recent ffmpeg version and streaming to youtube (and twitch?) and for custom services.
|
Allow flv av1 if recent ffmpeg version and streaming to youtube (and twitch?) and for custom services.
|
||||||
Use explicit sync in pipewire video code: https://docs.pipewire.org/page_dma_buf.html.
|
Use explicit sync in pipewire video code: https://docs.pipewire.org/page_dma_buf.html.
|
||||||
|
|
||||||
Support vaapi rotation. Support for it is added in mesa here: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32919.
|
|
||||||
|
|
||||||
Replay (and recording?) fails to save properly sometimes (especially for long videos). This is noticable with mp4 files since they get corrupt and become unplayable.
|
Replay (and recording?) fails to save properly sometimes (especially for long videos). This is noticable with mp4 files since they get corrupt and become unplayable.
|
||||||
The entire video does seem to get saved (it's a large video file) and it seems to have the correct headers but it's not playable.
|
The entire video does seem to get saved (it's a large video file) and it seems to have the correct headers but it's not playable.
|
||||||
|
|
||||||
@@ -347,4 +345,14 @@ Maybe use VK_VALVE_video_encode_rgb_conversion with vulkan encoding for shader-l
|
|||||||
|
|
||||||
Cursor sometimes doesn't have color when capturing region scaled (on kde plasma wayland at least).
|
Cursor sometimes doesn't have color when capturing region scaled (on kde plasma wayland at least).
|
||||||
|
|
||||||
Remove drm_monitor_get_display_server_data and do that work in the drm monitor query.
|
Remove drm_monitor_get_display_server_data and do that work in the drm monitor query.
|
||||||
|
|
||||||
|
In gpu screen recorder --info output codec max resolutions. This allows for better error messages in ui frontends and easier and better error handling.
|
||||||
|
|
||||||
|
Set minimum fps for live stream or piping or always.
|
||||||
|
|
||||||
|
Support youtube sso.
|
||||||
|
|
||||||
|
Remove -fm content (support it but remove it from documentation and output deprecation notice when its used) and use it when using -fm vbr (which is the default option).
|
||||||
|
But first -fm content needs to be support on wayland as well, by checking if there is a difference between frames (checksum the frame content).
|
||||||
|
-fm content also needs to have a minimum fps to prevent live stream from timing out when nothing changes on the screen.
|
||||||
|
|||||||
@@ -79,8 +79,8 @@ typedef struct {
|
|||||||
struct spa_video_info format;
|
struct spa_video_info format;
|
||||||
int server_version_sync;
|
int server_version_sync;
|
||||||
bool negotiated;
|
bool negotiated;
|
||||||
bool renegotiated;
|
|
||||||
bool damaged;
|
bool damaged;
|
||||||
|
bool has_modifier;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool visible;
|
bool visible;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
project('gpu-screen-recorder', ['c', 'cpp'], version : '5.9.1', default_options : ['warning_level=2'])
|
project('gpu-screen-recorder', ['c', 'cpp'], version : '5.9.3', default_options : ['warning_level=2'])
|
||||||
|
|
||||||
add_project_arguments('-Wshadow', language : ['c', 'cpp'])
|
add_project_arguments('-Wshadow', language : ['c', 'cpp'])
|
||||||
if get_option('buildtype') == 'debug'
|
if get_option('buildtype') == 'debug'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "gpu-screen-recorder"
|
name = "gpu-screen-recorder"
|
||||||
type = "executable"
|
type = "executable"
|
||||||
version = "5.9.1"
|
version = "5.9.3"
|
||||||
platforms = ["posix"]
|
platforms = ["posix"]
|
||||||
|
|
||||||
[config]
|
[config]
|
||||||
|
|||||||
119
src/main.cpp
119
src/main.cpp
@@ -1645,32 +1645,6 @@ static bool get_supported_video_codecs(gsr_egl *egl, gsr_video_codec video_codec
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool get_supported_video_codecs_with_cpu_fallback(gsr_egl *egl, args_parser *args_parser, bool cleanup, gsr_supported_video_codecs *video_codecs) {
|
|
||||||
if(get_supported_video_codecs(egl, args_parser->video_codec, args_parser->video_encoder == GSR_VIDEO_ENCODER_HW_CPU, cleanup, video_codecs))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if(args_parser->video_encoder == GSR_VIDEO_ENCODER_HW_CPU || !args_parser->fallback_cpu_encoding)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
fprintf(stderr, "gsr warning: gpu encoding is not available on your system, trying cpu encoding instead because -fallback-cpu-encoding is enabled. Install the proper vaapi drivers on your system (if supported) if you experience performance issues\n");
|
|
||||||
|
|
||||||
if(get_supported_video_codecs(egl, GSR_VIDEO_CODEC_H264, true, cleanup, video_codecs)) {
|
|
||||||
if(args_parser->video_codec != (gsr_video_codec)GSR_VIDEO_CODEC_AUTO && args_parser->video_codec != GSR_VIDEO_CODEC_H264) {
|
|
||||||
fprintf(stderr, "gsr warning: cpu encoding is used but video codec isn't set to h264. Forcing video codec to h264\n");
|
|
||||||
args_parser->video_codec = GSR_VIDEO_CODEC_H264;
|
|
||||||
}
|
|
||||||
|
|
||||||
args_parser->video_encoder = GSR_VIDEO_ENCODER_HW_CPU;
|
|
||||||
if(args_parser->video_encoder == GSR_VIDEO_ENCODER_HW_CPU && args_parser->bitrate_mode == GSR_BITRATE_MODE_VBR) {
|
|
||||||
fprintf(stderr, "gsr warning: bitrate mode has been forcefully set to qp because software encoding option doesn't support vbr option\n");
|
|
||||||
args_parser->bitrate_mode = GSR_BITRATE_MODE_QP;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void xwayland_check_callback(const gsr_monitor *monitor, void *userdata) {
|
static void xwayland_check_callback(const gsr_monitor *monitor, void *userdata) {
|
||||||
bool *xwayland_found = (bool*)userdata;
|
bool *xwayland_found = (bool*)userdata;
|
||||||
if(monitor->name_len >= 8 && strncmp(monitor->name, "XWAYLAND", 8) == 0)
|
if(monitor->name_len >= 8 && strncmp(monitor->name, "XWAYLAND", 8) == 0)
|
||||||
@@ -2757,21 +2731,31 @@ static void print_codec_error(gsr_video_codec video_codec) {
|
|||||||
" You can test this by running 'vainfo | grep VAEntrypointEncSlice' to see if it matches any H264/HEVC/AV1/VP8/VP9 profile.\n"
|
" You can test this by running 'vainfo | grep VAEntrypointEncSlice' to see if it matches any H264/HEVC/AV1/VP8/VP9 profile.\n"
|
||||||
" On such distros, you need to manually install mesa from source to enable H264/HEVC hardware acceleration, or use a more user friendly distro. Alternatively record with AV1 if supported by your GPU.\n"
|
" On such distros, you need to manually install mesa from source to enable H264/HEVC hardware acceleration, or use a more user friendly distro. Alternatively record with AV1 if supported by your GPU.\n"
|
||||||
" You can alternatively use the flatpak version of GPU Screen Recorder (https://flathub.org/apps/com.dec05eba.gpu_screen_recorder) which bypasses system issues with patented H264/HEVC codecs.\n"
|
" You can alternatively use the flatpak version of GPU Screen Recorder (https://flathub.org/apps/com.dec05eba.gpu_screen_recorder) which bypasses system issues with patented H264/HEVC codecs.\n"
|
||||||
" Make sure you have mesa-extra freedesktop runtime installed when using the flatpak (this should be the default), which can be installed with this command:\n"
|
" If your GPU doesn't support hardware accelerated video encoding then you can use '-fallback-cpu-encoding yes' option to encode with your cpu instead.\n", video_codec_name, video_codec_name, video_codec_name);
|
||||||
" flatpak install --system org.freedesktop.Platform.GL.default//23.08-extra\n"
|
|
||||||
" If your GPU doesn't support hardware accelerated video encoding then you can use '-encoder cpu' option to encode with your cpu instead.\n", video_codec_name, video_codec_name, video_codec_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const AVCodec* pick_video_codec(gsr_egl *egl, args_parser *args_parser, bool is_flv, bool *low_power, gsr_supported_video_codecs *supported_video_codecs) {
|
static void force_cpu_encoding(args_parser *args_parser) {
|
||||||
|
args_parser->video_codec = GSR_VIDEO_CODEC_H264;
|
||||||
|
args_parser->video_encoder = GSR_VIDEO_ENCODER_HW_CPU;
|
||||||
|
if(args_parser->bitrate_mode == GSR_BITRATE_MODE_VBR) {
|
||||||
|
fprintf(stderr, "gsr warning: bitrate mode has been forcefully set to qp because software encoding option doesn't support vbr option\n");
|
||||||
|
args_parser->bitrate_mode = GSR_BITRATE_MODE_QP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const AVCodec* pick_video_codec(gsr_egl *egl, args_parser *args_parser, bool use_fallback_codec, bool *low_power, gsr_supported_video_codecs *supported_video_codecs) {
|
||||||
// TODO: software encoder for hevc, av1, vp8 and vp9
|
// TODO: software encoder for hevc, av1, vp8 and vp9
|
||||||
*low_power = false;
|
*low_power = false;
|
||||||
const AVCodec *video_codec_f = get_av_codec_if_supported(args_parser->video_codec, egl, args_parser->video_encoder == GSR_VIDEO_ENCODER_HW_CPU, supported_video_codecs);
|
const AVCodec *video_codec_f = get_av_codec_if_supported(args_parser->video_codec, egl, args_parser->video_encoder == GSR_VIDEO_ENCODER_HW_CPU, supported_video_codecs);
|
||||||
|
|
||||||
if(!video_codec_f && !is_flv && args_parser->video_encoder != GSR_VIDEO_ENCODER_HW_CPU) {
|
if(!video_codec_f && use_fallback_codec && args_parser->video_encoder != GSR_VIDEO_ENCODER_HW_CPU) {
|
||||||
switch(args_parser->video_codec) {
|
switch(args_parser->video_codec) {
|
||||||
case GSR_VIDEO_CODEC_H264: {
|
case GSR_VIDEO_CODEC_H264: {
|
||||||
fprintf(stderr, "gsr warning: selected video codec h264 is not supported, trying hevc instead\n");
|
fprintf(stderr, "gsr error: selected video codec h264 is not supported\n");
|
||||||
args_parser->video_codec = GSR_VIDEO_CODEC_HEVC;
|
if(args_parser->fallback_cpu_encoding) {
|
||||||
|
fprintf(stderr, "gsr warning: gpu encoding is not available on your system, trying cpu encoding instead because -fallback-cpu-encoding is enabled. Install the proper vaapi drivers on your system (if supported) if you experience performance issues\n");
|
||||||
|
force_cpu_encoding(args_parser);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GSR_VIDEO_CODEC_HEVC:
|
case GSR_VIDEO_CODEC_HEVC:
|
||||||
@@ -2779,14 +2763,14 @@ static const AVCodec* pick_video_codec(gsr_egl *egl, args_parser *args_parser, b
|
|||||||
case GSR_VIDEO_CODEC_HEVC_10BIT: {
|
case GSR_VIDEO_CODEC_HEVC_10BIT: {
|
||||||
fprintf(stderr, "gsr warning: selected video codec hevc is not supported, trying h264 instead\n");
|
fprintf(stderr, "gsr warning: selected video codec hevc is not supported, trying h264 instead\n");
|
||||||
args_parser->video_codec = GSR_VIDEO_CODEC_H264;
|
args_parser->video_codec = GSR_VIDEO_CODEC_H264;
|
||||||
break;
|
return pick_video_codec(egl, args_parser, true, low_power, supported_video_codecs);
|
||||||
}
|
}
|
||||||
case GSR_VIDEO_CODEC_AV1:
|
case GSR_VIDEO_CODEC_AV1:
|
||||||
case GSR_VIDEO_CODEC_AV1_HDR:
|
case GSR_VIDEO_CODEC_AV1_HDR:
|
||||||
case GSR_VIDEO_CODEC_AV1_10BIT: {
|
case GSR_VIDEO_CODEC_AV1_10BIT: {
|
||||||
fprintf(stderr, "gsr warning: selected video codec av1 is not supported, trying h264 instead\n");
|
fprintf(stderr, "gsr warning: selected video codec av1 is not supported, trying h264 instead\n");
|
||||||
args_parser->video_codec = GSR_VIDEO_CODEC_H264;
|
args_parser->video_codec = GSR_VIDEO_CODEC_H264;
|
||||||
break;
|
return pick_video_codec(egl, args_parser, true, low_power, supported_video_codecs);
|
||||||
}
|
}
|
||||||
case GSR_VIDEO_CODEC_VP8:
|
case GSR_VIDEO_CODEC_VP8:
|
||||||
case GSR_VIDEO_CODEC_VP9:
|
case GSR_VIDEO_CODEC_VP9:
|
||||||
@@ -2796,23 +2780,23 @@ static const AVCodec* pick_video_codec(gsr_egl *egl, args_parser *args_parser, b
|
|||||||
fprintf(stderr, "gsr warning: selected video codec h264_vulkan is not supported, trying h264 instead\n");
|
fprintf(stderr, "gsr warning: selected video codec h264_vulkan is not supported, trying h264 instead\n");
|
||||||
args_parser->video_codec = GSR_VIDEO_CODEC_H264;
|
args_parser->video_codec = GSR_VIDEO_CODEC_H264;
|
||||||
// Need to do a query again because this time it's without vulkan
|
// Need to do a query again because this time it's without vulkan
|
||||||
if(!get_supported_video_codecs_with_cpu_fallback(egl, args_parser, true, supported_video_codecs)) {
|
if(!get_supported_video_codecs(egl, args_parser->video_codec, false, true, supported_video_codecs)) {
|
||||||
fprintf(stderr, "gsr error: failed to query for supported video codecs\n");
|
fprintf(stderr, "gsr error: failed to query for supported video codecs\n");
|
||||||
print_codec_error(args_parser->video_codec);
|
print_codec_error(args_parser->video_codec);
|
||||||
_exit(11);
|
_exit(11);
|
||||||
}
|
}
|
||||||
break;
|
return pick_video_codec(egl, args_parser, true, low_power, supported_video_codecs);
|
||||||
}
|
}
|
||||||
case GSR_VIDEO_CODEC_HEVC_VULKAN: {
|
case GSR_VIDEO_CODEC_HEVC_VULKAN: {
|
||||||
fprintf(stderr, "gsr warning: selected video codec hevc_vulkan is not supported, trying hevc instead\n");
|
fprintf(stderr, "gsr warning: selected video codec hevc_vulkan is not supported, trying hevc instead\n");
|
||||||
args_parser->video_codec = GSR_VIDEO_CODEC_HEVC;
|
args_parser->video_codec = GSR_VIDEO_CODEC_HEVC;
|
||||||
// Need to do a query again because this time it's without vulkan
|
// Need to do a query again because this time it's without vulkan
|
||||||
if(!get_supported_video_codecs_with_cpu_fallback(egl, args_parser, true, supported_video_codecs)) {
|
if(!get_supported_video_codecs(egl, args_parser->video_codec, false, true, supported_video_codecs)) {
|
||||||
fprintf(stderr, "gsr error: failed to query for supported video codecs\n");
|
fprintf(stderr, "gsr error: failed to query for supported video codecs\n");
|
||||||
print_codec_error(args_parser->video_codec);
|
print_codec_error(args_parser->video_codec);
|
||||||
_exit(11);
|
_exit(11);
|
||||||
}
|
}
|
||||||
break;
|
return pick_video_codec(egl, args_parser, true, low_power, supported_video_codecs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2852,19 +2836,9 @@ static gsr_video_codec select_appropriate_video_codec_automatically(gsr_capture_
|
|||||||
|
|
||||||
static const AVCodec* select_video_codec_with_fallback(gsr_capture_metadata capture_metadata, args_parser *args_parser, const char *file_extension, gsr_egl *egl, bool *low_power) {
|
static const AVCodec* select_video_codec_with_fallback(gsr_capture_metadata capture_metadata, args_parser *args_parser, const char *file_extension, gsr_egl *egl, bool *low_power) {
|
||||||
gsr_supported_video_codecs supported_video_codecs;
|
gsr_supported_video_codecs supported_video_codecs;
|
||||||
if(!get_supported_video_codecs_with_cpu_fallback(egl, args_parser, true, &supported_video_codecs)) {
|
get_supported_video_codecs(egl, args_parser->video_codec, args_parser->video_encoder == GSR_VIDEO_ENCODER_HW_CPU, true, &supported_video_codecs);
|
||||||
fprintf(stderr, "gsr error: failed to query for supported video codecs\n");
|
// TODO: Use gsr_supported_video_codecs *supported_video_codecs_vulkan here to properly query vulkan video support
|
||||||
print_codec_error(args_parser->video_codec);
|
set_supported_video_codecs_ffmpeg(&supported_video_codecs, nullptr, egl->gpu_info.vendor);
|
||||||
_exit(11);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args_parser->video_encoder == GSR_VIDEO_ENCODER_HW_CPU && args_parser->video_codec != (gsr_video_codec)GSR_VIDEO_CODEC_AUTO && args_parser->video_codec != GSR_VIDEO_CODEC_H264) {
|
|
||||||
fprintf(stderr, "gsr warning: cpu encoding is used but video codec isn't set to h264. Forcing video codec to h264\n");
|
|
||||||
args_parser->video_codec = GSR_VIDEO_CODEC_H264;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args_parser->video_encoder != GSR_VIDEO_ENCODER_HW_CPU)
|
|
||||||
set_supported_video_codecs_ffmpeg(&supported_video_codecs, nullptr, egl->gpu_info.vendor);
|
|
||||||
|
|
||||||
const bool video_codec_auto = args_parser->video_codec == (gsr_video_codec)GSR_VIDEO_CODEC_AUTO;
|
const bool video_codec_auto = args_parser->video_codec == (gsr_video_codec)GSR_VIDEO_CODEC_AUTO;
|
||||||
if(video_codec_auto) {
|
if(video_codec_auto) {
|
||||||
@@ -2874,45 +2848,35 @@ static const AVCodec* select_video_codec_with_fallback(gsr_capture_metadata capt
|
|||||||
} else if(args_parser->video_encoder == GSR_VIDEO_ENCODER_HW_CPU) {
|
} else if(args_parser->video_encoder == GSR_VIDEO_ENCODER_HW_CPU) {
|
||||||
fprintf(stderr, "gsr info: using h264 encoder because a codec was not specified\n");
|
fprintf(stderr, "gsr info: using h264 encoder because a codec was not specified\n");
|
||||||
args_parser->video_codec = GSR_VIDEO_CODEC_H264;
|
args_parser->video_codec = GSR_VIDEO_CODEC_H264;
|
||||||
} else {
|
} else if(args_parser->video_encoder != GSR_VIDEO_ENCODER_HW_CPU) {
|
||||||
args_parser->video_codec = select_appropriate_video_codec_automatically(capture_metadata, &supported_video_codecs);
|
args_parser->video_codec = select_appropriate_video_codec_automatically(capture_metadata, &supported_video_codecs);
|
||||||
if(args_parser->video_codec == (gsr_video_codec)-1) {
|
if(args_parser->video_codec == (gsr_video_codec)-1) {
|
||||||
fprintf(stderr, "gsr error: no video encoder was specified and neither h264, hevc nor av1 are supported on your system or you are trying to capture at a resolution higher than your system supports for each codec\n");
|
if(args_parser->fallback_cpu_encoding) {
|
||||||
_exit(52);
|
fprintf(stderr, "gsr warning: gpu encoding is not available on your system or your gpu doesn't support recording at the resolution you are trying to record, trying cpu encoding instead because -fallback-cpu-encoding is enabled. Install the proper vaapi drivers on your system (if supported) if you experience performance issues\n");
|
||||||
|
force_cpu_encoding(args_parser);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "gsr error: no video encoder was specified and neither h264, hevc nor av1 are supported on your system or you are trying to capture at a resolution higher than your system supports for each codec.\n");
|
||||||
|
fprintf(stderr, " Ensure that you have installed the proper vaapi driver. If your gpu doesn't support video encoding then you can run gpu-screen-recorder with \"-fallback-cpu-encoding yes\" option to use cpu encoding.\n");
|
||||||
|
_exit(52);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Allow hevc, vp9 and av1 in (enhanced) flv (supported since ffmpeg 6.1)
|
// TODO: Allow hevc, vp9 and av1 in (enhanced) flv (supported since ffmpeg 6.1)
|
||||||
const bool is_flv = strcmp(file_extension, "flv") == 0;
|
if(LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(60, 10, 100) && strcmp(file_extension, "flv") == 0) {
|
||||||
if(is_flv) {
|
|
||||||
if(args_parser->video_codec != GSR_VIDEO_CODEC_H264) {
|
if(args_parser->video_codec != GSR_VIDEO_CODEC_H264) {
|
||||||
args_parser->video_codec = GSR_VIDEO_CODEC_H264;
|
args_parser->video_codec = GSR_VIDEO_CODEC_H264;
|
||||||
fprintf(stderr, "gsr warning: hevc/av1 is not compatible with flv, falling back to h264 instead.\n");
|
fprintf(stderr, "gsr warning: hevc/av1 is not compatible with flv in your outdated version of ffmpeg, falling back to h264 instead.\n");
|
||||||
}
|
}
|
||||||
|
} else if(strcmp(file_extension, "m3u8") == 0) {
|
||||||
// if(audio_codec != GSR_AUDIO_CODEC_AAC) {
|
|
||||||
// audio_codec_to_use = "aac";
|
|
||||||
// audio_codec = GSR_AUDIO_CODEC_AAC;
|
|
||||||
// fprintf(stderr, "gsr warning: flv only supports aac, falling back to aac instead.\n");
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool is_hls = strcmp(file_extension, "m3u8") == 0;
|
|
||||||
if(is_hls) {
|
|
||||||
if(video_codec_is_av1(args_parser->video_codec)) {
|
if(video_codec_is_av1(args_parser->video_codec)) {
|
||||||
args_parser->video_codec = GSR_VIDEO_CODEC_HEVC;
|
args_parser->video_codec = GSR_VIDEO_CODEC_HEVC;
|
||||||
fprintf(stderr, "gsr warning: av1 is not compatible with hls (m3u8), falling back to hevc instead.\n");
|
fprintf(stderr, "gsr warning: av1 is not compatible with hls (m3u8), falling back to hevc instead.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(audio_codec != GSR_AUDIO_CODEC_AAC) {
|
|
||||||
// audio_codec_to_use = "aac";
|
|
||||||
// audio_codec = GSR_AUDIO_CODEC_AAC;
|
|
||||||
// fprintf(stderr, "gsr warning: hls (m3u8) only supports aac, falling back to aac instead.\n");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const AVCodec *codec = pick_video_codec(egl, args_parser, is_flv, low_power, &supported_video_codecs);
|
const AVCodec *codec = pick_video_codec(egl, args_parser, true, low_power, &supported_video_codecs);
|
||||||
|
|
||||||
const vec2i codec_max_resolution = codec_get_max_resolution(args_parser->video_codec, args_parser->video_encoder == GSR_VIDEO_ENCODER_HW_CPU, &supported_video_codecs);
|
const vec2i codec_max_resolution = codec_get_max_resolution(args_parser->video_codec, args_parser->video_encoder == GSR_VIDEO_ENCODER_HW_CPU, &supported_video_codecs);
|
||||||
const vec2i capture_size = {capture_metadata.video_width, capture_metadata.video_height};
|
const vec2i capture_size = {capture_metadata.video_width, capture_metadata.video_height};
|
||||||
@@ -3339,6 +3303,11 @@ int main(int argc, char **argv) {
|
|||||||
AVStream *video_stream = nullptr;
|
AVStream *video_stream = nullptr;
|
||||||
std::vector<AudioTrack> audio_tracks;
|
std::vector<AudioTrack> audio_tracks;
|
||||||
|
|
||||||
|
if(arg_parser.video_encoder == GSR_VIDEO_ENCODER_HW_CPU && arg_parser.video_codec != (gsr_video_codec)GSR_VIDEO_CODEC_AUTO && arg_parser.video_codec != GSR_VIDEO_CODEC_H264) {
|
||||||
|
fprintf(stderr, "gsr error: -encoder cpu was specified but a codec other than h264 was specified. -encoder cpu supports only h264 at the moment\n");
|
||||||
|
_exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
bool low_power = false;
|
bool low_power = false;
|
||||||
const AVCodec *video_codec_f = select_video_codec_with_fallback(capture_metadata, &arg_parser, file_extension.c_str(), &egl, &low_power);
|
const AVCodec *video_codec_f = select_video_codec_with_fallback(capture_metadata, &arg_parser, file_extension.c_str(), &egl, &low_power);
|
||||||
|
|
||||||
|
|||||||
@@ -280,7 +280,8 @@ static void on_param_changed_cb(void *user_data, uint32_t id, const struct spa_p
|
|||||||
self->format.info.raw.format,
|
self->format.info.raw.format,
|
||||||
spa_debug_type_find_name(spa_type_video_format, self->format.info.raw.format));
|
spa_debug_type_find_name(spa_type_video_format, self->format.info.raw.format));
|
||||||
|
|
||||||
if(has_modifier) {
|
self->has_modifier = has_modifier;
|
||||||
|
if(self->has_modifier) {
|
||||||
fprintf(stderr, "gsr info: pipewire: Modifier: 0x%" PRIx64 "\n", self->format.info.raw.modifier);
|
fprintf(stderr, "gsr info: pipewire: Modifier: 0x%" PRIx64 "\n", self->format.info.raw.modifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -736,7 +737,6 @@ void gsr_pipewire_video_deinit(gsr_pipewire_video *self) {
|
|||||||
self->dmabuf_num_planes = 0;
|
self->dmabuf_num_planes = 0;
|
||||||
|
|
||||||
self->negotiated = false;
|
self->negotiated = false;
|
||||||
self->renegotiated = false;
|
|
||||||
|
|
||||||
if(self->mutex_initialized) {
|
if(self->mutex_initialized) {
|
||||||
pthread_mutex_destroy(&self->mutex);
|
pthread_mutex_destroy(&self->mutex);
|
||||||
@@ -783,21 +783,20 @@ static EGLImage gsr_pipewire_video_create_egl_image_with_fallback(gsr_pipewire_v
|
|||||||
}
|
}
|
||||||
|
|
||||||
EGLImage image = NULL;
|
EGLImage image = NULL;
|
||||||
if(self->no_modifiers_fallback) {
|
if(self->no_modifiers_fallback || !self->has_modifier) {
|
||||||
image = gsr_pipewire_video_create_egl_image(self, fds, offsets, pitches, modifiers, false);
|
image = gsr_pipewire_video_create_egl_image(self, fds, offsets, pitches, modifiers, false);
|
||||||
} else {
|
} else {
|
||||||
image = gsr_pipewire_video_create_egl_image(self, fds, offsets, pitches, modifiers, true);
|
image = gsr_pipewire_video_create_egl_image(self, fds, offsets, pitches, modifiers, true);
|
||||||
if(!image) {
|
if(!image) {
|
||||||
if(self->renegotiated || self->format.info.raw.modifier == DRM_FORMAT_MOD_INVALID) {
|
if(self->format.info.raw.modifier == DRM_FORMAT_MOD_INVALID) {
|
||||||
fprintf(stderr, "gsr error: gsr_pipewire_video_create_egl_image_with_fallback: failed to create egl image with modifiers, trying without modifiers\n");
|
fprintf(stderr, "gsr error: gsr_pipewire_video_create_egl_image_with_fallback: failed to create egl image with modifiers, trying without modifiers\n");
|
||||||
self->no_modifiers_fallback = true;
|
self->no_modifiers_fallback = true;
|
||||||
image = gsr_pipewire_video_create_egl_image(self, fds, offsets, pitches, modifiers, false);
|
image = gsr_pipewire_video_create_egl_image(self, fds, offsets, pitches, modifiers, false);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "gsr error: gsr_pipewire_video_create_egl_image_with_fallback: failed to create egl image with modifiers, renegotiating with a different modifier\n");
|
fprintf(stderr, "gsr error: gsr_pipewire_video_create_egl_image_with_fallback: failed to create egl image with modifiers, renegotiating with a different modifier\n");
|
||||||
self->negotiated = false;
|
self->negotiated = false;
|
||||||
self->renegotiated = true;
|
|
||||||
gsr_pipewire_video_remove_modifier(self, self->format.info.raw.modifier);
|
|
||||||
pw_thread_loop_lock(self->thread_loop);
|
pw_thread_loop_lock(self->thread_loop);
|
||||||
|
gsr_pipewire_video_remove_modifier(self, self->format.info.raw.modifier);
|
||||||
pw_loop_signal_event(pw_thread_loop_get_loop(self->thread_loop), self->reneg);
|
pw_loop_signal_event(pw_thread_loop_get_loop(self->thread_loop), self->reneg);
|
||||||
pw_thread_loop_unlock(self->thread_loop);
|
pw_thread_loop_unlock(self->thread_loop);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user