]> git.sesse.net Git - nageru/blobdiff - nageru/flags.cpp
Update README for Debian bullseye.
[nageru] / nageru / flags.cpp
index 402e33d7eca7a0be7d05d6ae87a4025f78ad9d0f..42fdb88b22a1b2639d8cf7c954b1284f7ec7ed8d 100644 (file)
@@ -24,6 +24,7 @@ enum LongOption {
        OPTION_HTTP_UNCOMPRESSED_VIDEO,
        OPTION_HTTP_X264_VIDEO,
        OPTION_RECORD_X264_VIDEO,
+       OPTION_SEPARATE_X264_DISK_ENCODE,
        OPTION_X264_PRESET,
        OPTION_X264_TUNE,
        OPTION_X264_SPEEDCONTROL,
@@ -33,6 +34,11 @@ enum LongOption {
        OPTION_X264_VBV_BUFSIZE,
        OPTION_X264_VBV_MAX_BITRATE,
        OPTION_X264_PARAM,
+       OPTION_X264_SEPARATE_DISK_PRESET,
+       OPTION_X264_SEPARATE_DISK_TUNE,
+       OPTION_X264_SEPARATE_DISK_BITRATE,
+       OPTION_X264_SEPARATE_DISK_CRF,
+       OPTION_X264_SEPARATE_DISK_PARAM,
        OPTION_HTTP_MUX,
        OPTION_HTTP_COARSE_TIMEBASE,
        OPTION_HTTP_AUDIO_CODEC,
@@ -40,6 +46,7 @@ enum LongOption {
        OPTION_HTTP_PORT,
        OPTION_SRT_PORT,
        OPTION_NO_SRT,
+       OPTION_NO_TRANSCODE_VIDEO,
        OPTION_NO_TRANSCODE_AUDIO,
        OPTION_DISABLE_AUDIO,
        OPTION_FLAT_AUDIO,
@@ -62,6 +69,7 @@ enum LongOption {
        OPTION_OUTPUT_YCBCR_COEFFICIENTS,
        OPTION_OUTPUT_BUFFER_FRAMES,
        OPTION_OUTPUT_SLOP_FRAMES,
+       OPTION_OUTPUT_CARD_UNSYNCHRONIZED,
        OPTION_TIMECODE_STREAM,
        OPTION_TIMECODE_STDOUT,
        OPTION_QUICK_CUT_KEYS,
@@ -153,6 +161,8 @@ void usage(Program program)
                fprintf(stderr, "      --http-x264-video           send x264-compressed video to HTTP clients\n");
                fprintf(stderr, "      --record-x264-video         store x264-compressed video to disk (implies --http-x264-video,\n");
                fprintf(stderr, "                                    removes the need for working VA-API encoding)\n");
+               fprintf(stderr, "      --separate-x264-disk-encode run a different x264 encoder for disk recording\n");
+               fprintf(stderr, "                                    (implies --record-x264-video)\n");
        }
        fprintf(stderr, "      --x264-preset               x264 quality preset (default " X264_DEFAULT_PRESET ")\n");
        fprintf(stderr, "      --x264-tune                 x264 tuning (default " X264_DEFAULT_TUNE ", can be blank)\n");
@@ -166,6 +176,15 @@ void usage(Program program)
        fprintf(stderr, "      --x264-vbv-max-bitrate      x264 local max bitrate (in kilobit/sec per --vbv-bufsize,\n");
        fprintf(stderr, "                                  0 = no limit, default: same as --x264-bitrate, i.e., CBR)\n");
        fprintf(stderr, "      --x264-param=NAME[,VALUE]   set any x264 parameter, for fine tuning\n");
+       if (program == PROGRAM_NAGERU) {
+               fprintf(stderr, "      --x264-separate-disk-preset x264 quality preset (default " X264_DEFAULT_PRESET ")\n");
+               fprintf(stderr, "      --x264-separate-disk-tune   x264 tuning (default " X264_DEFAULT_TUNE ", can be blank)\n");
+               fprintf(stderr, "      --x264-separate-disk-bitrate  x264 bitrate (in kilobit/sec, default %d)\n",
+                       DEFAULT_X264_OUTPUT_BIT_RATE);
+               fprintf(stderr, "      --x264-separate-disk-crf=VALUE  quality-based VBR (-12 to 51), \n");
+               fprintf(stderr, "                                  incompatible with --x264-separate-disk-bitrate\n");
+               fprintf(stderr, "      --x264-separate-disk-param=NAME[,VALUE] set any x264 parameter, for fine tuning\n");
+       }
        fprintf(stderr, "      --http-mux=NAME             mux to use for HTTP streams (default " DEFAULT_STREAM_MUX_NAME ")\n");
        fprintf(stderr, "      --http-audio-codec=NAME     audio codec to use for HTTP streams\n");
        fprintf(stderr, "                                  (default is to use the same as for the recording)\n");
@@ -178,6 +197,8 @@ void usage(Program program)
        fprintf(stderr, "                                  (default is %d)\n", DEFAULT_SRT_PORT);
        fprintf(stderr, "      --no-srt                    disable receiving SRT streams\n");
        if (program == PROGRAM_KAERU) {
+               fprintf(stderr, "      --no-transcode-video        copy encoded video raw from the source stream\n");
+               fprintf(stderr, "                                    (experimental, must be H.264)\n");
                fprintf(stderr, "      --no-transcode-audio        copy encoded audio raw from the source stream\n");
                fprintf(stderr, "                                    (requires --http-audio-codec= to be set)\n");
                fprintf(stderr, "      --disable-audio             do not include any audio in the stream\n");
@@ -210,6 +231,8 @@ void usage(Program program)
                fprintf(stderr, "      --output-slop-frames=NUM    if more less than this number of frames behind for\n");
                fprintf(stderr, "                                    --output-card, try to submit anyway instead of\n");
                fprintf(stderr, "                                    dropping the frame (default 0.5)\n");
+               fprintf(stderr, "      --output-card-unsynchronized  if --output-card is in use, do _not_ use it as\n");
+               fprintf(stderr, "                                  master clock (may give jittery output and audio breakups)\n");
                fprintf(stderr, "      --timecode-stream           show timestamp and timecode in stream\n");
                fprintf(stderr, "      --timecode-stdout           show timestamp and timecode on standard output\n");
                fprintf(stderr, "      --quick-cut-keys            enable direct cutting by Q, W, E, ... keys\n");
@@ -251,6 +274,7 @@ void parse_flags(Program program, int argc, char * const argv[])
                { "http-uncompressed-video", no_argument, 0, OPTION_HTTP_UNCOMPRESSED_VIDEO },
                { "http-x264-video", no_argument, 0, OPTION_HTTP_X264_VIDEO },
                { "record-x264-video", no_argument, 0, OPTION_RECORD_X264_VIDEO },
+               { "separate-x264-disk-encode", no_argument, 0, OPTION_SEPARATE_X264_DISK_ENCODE },
                { "x264-preset", required_argument, 0, OPTION_X264_PRESET },
                { "x264-tune", required_argument, 0, OPTION_X264_TUNE },
                { "x264-speedcontrol", no_argument, 0, OPTION_X264_SPEEDCONTROL },
@@ -260,12 +284,18 @@ void parse_flags(Program program, int argc, char * const argv[])
                { "x264-vbv-bufsize", required_argument, 0, OPTION_X264_VBV_BUFSIZE },
                { "x264-vbv-max-bitrate", required_argument, 0, OPTION_X264_VBV_MAX_BITRATE },
                { "x264-param", required_argument, 0, OPTION_X264_PARAM },
+               { "x264-separate-disk-preset", required_argument, 0, OPTION_X264_SEPARATE_DISK_PRESET },
+               { "x264-separate-disk-tune", required_argument, 0, OPTION_X264_SEPARATE_DISK_TUNE },
+               { "x264-separate-disk-bitrate", required_argument, 0, OPTION_X264_SEPARATE_DISK_BITRATE },
+               { "x264-separate-disk-crf", required_argument, 0, OPTION_X264_SEPARATE_DISK_CRF },
+               { "x264-separate-disk-param", required_argument, 0, OPTION_X264_SEPARATE_DISK_PARAM },
                { "http-mux", required_argument, 0, OPTION_HTTP_MUX },
                { "http-audio-codec", required_argument, 0, OPTION_HTTP_AUDIO_CODEC },
                { "http-audio-bitrate", required_argument, 0, OPTION_HTTP_AUDIO_BITRATE },
                { "http-port", required_argument, 0, OPTION_HTTP_PORT },
                { "srt-port", required_argument, 0, OPTION_SRT_PORT },
                { "no-srt", no_argument, 0, OPTION_NO_SRT },
+               { "no-transcode-video", no_argument, 0, OPTION_NO_TRANSCODE_VIDEO },
                { "no-transcode-audio", no_argument, 0, OPTION_NO_TRANSCODE_AUDIO },
                { "disable-audio", no_argument, 0, OPTION_DISABLE_AUDIO },
                { "flat-audio", no_argument, 0, OPTION_FLAT_AUDIO },
@@ -288,6 +318,7 @@ void parse_flags(Program program, int argc, char * const argv[])
                { "output-ycbcr-coefficients", required_argument, 0, OPTION_OUTPUT_YCBCR_COEFFICIENTS },
                { "output-buffer-frames", required_argument, 0, OPTION_OUTPUT_BUFFER_FRAMES },
                { "output-slop-frames", required_argument, 0, OPTION_OUTPUT_SLOP_FRAMES },
+               { "output-card-unsynchronized", no_argument, 0, OPTION_OUTPUT_CARD_UNSYNCHRONIZED },
                { "timecode-stream", no_argument, 0, OPTION_TIMECODE_STREAM },
                { "timecode-stdout", no_argument, 0, OPTION_TIMECODE_STDOUT },
                { "quick-cut-keys", no_argument, 0, OPTION_QUICK_CUT_KEYS },
@@ -392,6 +423,9 @@ void parse_flags(Program program, int argc, char * const argv[])
                case OPTION_NO_SRT:
                        global_flags.srt_port = -1;
                        break;
+               case OPTION_NO_TRANSCODE_VIDEO:
+                       global_flags.transcode_video = false;
+                       break;
                case OPTION_NO_TRANSCODE_AUDIO:
                        global_flags.transcode_audio = false;
                        break;
@@ -406,6 +440,11 @@ void parse_flags(Program program, int argc, char * const argv[])
                        global_flags.x264_video_to_disk = true;
                        global_flags.x264_video_to_http = true;
                        break;
+               case OPTION_SEPARATE_X264_DISK_ENCODE:
+                       global_flags.x264_video_to_disk = true;
+                       global_flags.x264_video_to_http = true;
+                       global_flags.x264_separate_disk_encode = true;
+                       break;
                case OPTION_X264_PRESET:
                        global_flags.x264_preset = optarg;
                        break;
@@ -433,6 +472,21 @@ void parse_flags(Program program, int argc, char * const argv[])
                case OPTION_X264_PARAM:
                        global_flags.x264_extra_param.push_back(optarg);
                        break;
+               case OPTION_X264_SEPARATE_DISK_PRESET:
+                       global_flags.x264_separate_disk_preset = optarg;
+                       break;
+               case OPTION_X264_SEPARATE_DISK_TUNE:
+                       global_flags.x264_separate_disk_tune = optarg;
+                       break;
+               case OPTION_X264_SEPARATE_DISK_BITRATE:
+                       global_flags.x264_separate_disk_bitrate = atoi(optarg);
+                       break;
+               case OPTION_X264_SEPARATE_DISK_CRF:
+                       global_flags.x264_separate_disk_crf = atof(optarg);
+                       break;
+               case OPTION_X264_SEPARATE_DISK_PARAM:
+                       global_flags.x264_separate_disk_extra_param.push_back(optarg);
+                       break;
                case OPTION_FLAT_AUDIO:
                        // If --flat-audio is given, turn off everything that messes with the sound,
                        // except the final makeup gain.
@@ -499,6 +553,9 @@ void parse_flags(Program program, int argc, char * const argv[])
                case OPTION_OUTPUT_SLOP_FRAMES:
                        global_flags.output_slop_frames = atof(optarg);
                        break;
+               case OPTION_OUTPUT_CARD_UNSYNCHRONIZED:
+                       global_flags.output_card_is_master = false;
+                       break;
                case OPTION_TIMECODE_STREAM:
                        global_flags.display_timecode_in_stream = true;
                        break;
@@ -623,6 +680,9 @@ void parse_flags(Program program, int argc, char * const argv[])
        } else if (global_flags.x264_preset.empty()) {
                global_flags.x264_preset = X264_DEFAULT_PRESET;
        }
+       if (global_flags.x264_separate_disk_preset.empty()) {
+               global_flags.x264_separate_disk_preset = X264_DEFAULT_PRESET;
+       }
        if (!theme_dirs.empty()) {
                global_flags.theme_dirs = theme_dirs;
        }
@@ -706,6 +766,15 @@ void parse_flags(Program program, int argc, char * const argv[])
                global_flags.x264_bitrate = DEFAULT_X264_OUTPUT_BIT_RATE;
        }
 
+       if (!isinf(global_flags.x264_separate_disk_crf)) {  // CRF mode is selected.
+               if (global_flags.x264_separate_disk_bitrate != -1) {
+                       fprintf(stderr, "ERROR: --x264-separate-disk-bitrate and --x264-separate-disk-crf are mutually incompatible.\n");
+                       exit(1);
+               }
+       } else if (global_flags.x264_separate_disk_bitrate == -1) {
+               global_flags.x264_separate_disk_bitrate = DEFAULT_X264_OUTPUT_BIT_RATE;
+       }
+
        if (!card_to_mjpeg_stream_export_set) {
                // Fill in the default mapping (export all cards, in order).
                for (unsigned card_idx = 0; card_idx < unsigned(global_flags.max_num_cards); ++card_idx) {