From 0f942c806786bdf1fa608d5cf32fdf8a418236b0 Mon Sep 17 00:00:00 2001 From: Matthew Wozniak Date: Mon, 18 Nov 2024 20:48:48 -0500 Subject: switch to using FFmpeg for encoding, add audio --- main.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 0761665..6cfa275 100644 --- a/main.c +++ b/main.c @@ -32,11 +32,11 @@ struct { int fps; int quality; int bitrate; - int qvs; const char *out; const char **demo; int demo_count; - bool combine; + const char *encoder; + const char *preset; } args = {0}; void (*orig_cbuf_addtext)(char *); @@ -84,12 +84,7 @@ typedef int (*LauncherMain_t)(void *instance, void *prev_inst, char *cmdline, int cmd_show); void usage() { - const char *usage = - "usage:\n" - " rt [-w ] [-h ] [-g ] [-r ] [-s ]" - "[-1] [-q ] OR [-b ]\n" - " path/to/video.mp4 path/to/demo1.dem..."; - puts(usage); + printf("invalid command line args! please read the readme\n"); } int main(int argc, const char **argv) { @@ -116,14 +111,7 @@ int main(int argc, const char **argv) { case 'q': arg = OPTARG(argc, argv); args.quality = strtol(arg, &strend, 10); - if (strend == arg || args.quality < 1 || args.quality > 100) - die("quality must be a number 1-100"); - break; - case 's': - arg = OPTARG(argc, argv); - args.qvs = strtol(arg, &strend, 10); - if (strend == arg || args.qvs < 1 || args.qvs > 100) - die("qvs must be a number 1-100"); + if (strend == arg) die("crf must be a number"); break; case 'b': arg = OPTARG(argc, argv); @@ -132,16 +120,22 @@ int main(int argc, const char **argv) { break; case 'g': args.game = OPTARG(argc, argv); - case '1': - args.combine = true; + break; + case 'p': + args.preset = OPTARG(argc, argv); + break; + case 'e': + args.encoder = OPTARG(argc, argv); + break; } + if (!args.encoder) args.encoder = "libx264"; if (!args.width) args.width = 1280; if (!args.height) args.height = 720; if (!args.game) args.game = "hl2"; if (!args.fps) args.fps = 30; - if (!args.quality) args.quality = 75; - if (!args.qvs) args.qvs = 100; + if (!args.quality) args.quality = 25; + if (!args.preset) args.preset = "fast"; if (argc < 2) { usage(); -- cgit v1.2.3-54-g00ecf