diff options
| author | Victor Nova <lostfreeman@gmail.com> | 2026-01-27 10:27:36 -0500 |
|---|---|---|
| committer | dec05eba <dec05eba@protonmail.com> | 2026-01-27 17:43:41 +0100 |
| commit | 144b4815262e86eb521776123d5ff9b7f7f4750d (patch) | |
| tree | e18e92e908ba0cf26b6eb0cb81a32a0f2fc6b091 /src/args_parser.c | |
| parent | f4ee71a094f9c6e0739199704268b79d6f3177ef (diff) | |
Add -write-first-frame-ts switch
Add -write-first-frame-ts switch that creates a .ts file next to the output
file with values from CLOCK_MONOTONIC and CLOCK_REALTIME corresponding to the
first frame to be able to synchronize video with other timestamped data.
Diffstat (limited to 'src/args_parser.c')
| -rw-r--r-- | src/args_parser.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/args_parser.c b/src/args_parser.c index 6debb77..fc3c904 100644 --- a/src/args_parser.c +++ b/src/args_parser.c @@ -196,7 +196,7 @@ static void usage_header(void) { "[-bm auto|qp|vbr|cbr] [-cr limited|full] [-tune performance|quality] [-df yes|no] [-sc <script_path>] [-p <plugin_path>] " "[-cursor yes|no] [-keyint <value>] [-restore-portal-session yes|no] [-portal-session-token-filepath filepath] [-encoder gpu|cpu] " "[-fallback-cpu-encoding yes|no] [-o <output_file>] [-ro <output_directory>] [-ffmpeg-opts <options>] [--list-capture-options [card_path]] " - "[--list-audio-devices] [--list-application-audio] [--list-v4l2-devices] [-low-power yes|no] [-v yes|no] [-gl-debug yes|no] [--version] [-h|--help]\n", program_name); + "[--list-audio-devices] [--list-application-audio] [--list-v4l2-devices] [-write-first-frame-ts yes|no] [-low-power yes|no] [-v yes|no] [-gl-debug yes|no] [--version] [-h|--help]\n", program_name); fflush(stdout); } @@ -255,6 +255,7 @@ static bool args_parser_set_values(args_parser *self) { self->restart_replay_on_save = args_get_boolean_by_key(self->args, NUM_ARGS, "-restart-replay-on-save", false); self->overclock = args_get_boolean_by_key(self->args, NUM_ARGS, "-oc", false); self->fallback_cpu_encoding = args_get_boolean_by_key(self->args, NUM_ARGS, "-fallback-cpu-encoding", false); + self->write_first_frame_ts = args_get_boolean_by_key(self->args, NUM_ARGS, "-write-first-frame-ts", false); self->low_power = args_get_boolean_by_key(self->args, NUM_ARGS, "-low-power", false); self->audio_bitrate = args_get_i64_by_key(self->args, NUM_ARGS, "-ab", 0); @@ -432,6 +433,10 @@ static bool args_parser_set_values(args_parser *self) { self->is_output_piped = strcmp(self->filename, "/dev/stdout") == 0; self->low_latency_recording = self->is_livestream || self->is_output_piped; + if(self->write_first_frame_ts && (self->is_livestream || self->is_output_piped)) { + fprintf(stderr, "gsr warning: -write-first-frame-ts is ignored for livestreaming or when output is piped\n"); + self->write_first_frame_ts = false; + } self->replay_recording_directory = args_get_value_by_key(self->args, NUM_ARGS, "-ro"); @@ -536,6 +541,7 @@ bool args_parser_parse(args_parser *self, int argc, char **argv, const args_hand self->args[arg_index++] = (Arg){ .key = "-ffmpeg-opts", .optional = true, .list = false, .type = ARG_TYPE_STRING }; self->args[arg_index++] = (Arg){ .key = "-ffmpeg-video-opts", .optional = true, .list = false, .type = ARG_TYPE_STRING }; self->args[arg_index++] = (Arg){ .key = "-ffmpeg-audio-opts", .optional = true, .list = false, .type = ARG_TYPE_STRING }; + self->args[arg_index++] = (Arg){ .key = "-write-first-frame-ts", .optional = true, .list = false, .type = ARG_TYPE_BOOLEAN }; self->args[arg_index++] = (Arg){ .key = "-low-power", .optional = true, .list = false, .type = ARG_TYPE_BOOLEAN }; assert(arg_index == NUM_ARGS); |
