diff options
author | Matthew Wozniak <me@woz.blue> | 2024-11-18 20:48:48 -0500 |
---|---|---|
committer | Matthew Wozniak <me@woz.blue> | 2024-11-18 20:48:48 -0500 |
commit | 0f942c806786bdf1fa608d5cf32fdf8a418236b0 (patch) | |
tree | b41b6c281bd5e29090bb1336e3aa1e925ad75a2d /main.c | |
parent | 983d0be5920f43b281154a167693ceaad86d8da4 (diff) | |
download | rt-0f942c806786bdf1fa608d5cf32fdf8a418236b0.tar.gz rt-0f942c806786bdf1fa608d5cf32fdf8a418236b0.zip |
switch to using FFmpeg for encoding, add audio
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 34 |
1 files changed, 14 insertions, 20 deletions
@@ -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 <width>] [-h <height>] [-g <game>] [-r <fps>] [-s <qvs>]" - "[-1] [-q <quality>] OR [-b <bitrate>]\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(); |