OPTION_HTTP_PORT,
OPTION_SRT_PORT,
OPTION_NO_SRT,
+ OPTION_SRT_DESTINATION,
+ OPTION_SRT_STREAMID,
+ OPTION_SRT_PASSPHRASE,
+ OPTION_SRT_YOUTUBE_STREAM_KEY,
+ OPTION_SRT_LATENCY,
OPTION_NO_TRANSCODE_VIDEO,
OPTION_NO_TRANSCODE_AUDIO,
OPTION_DISABLE_AUDIO,
fprintf(stderr, " --midi-mapping=FILE start with the given MIDI controller mapping (implies --multichannel)\n");
fprintf(stderr, " --default-hdmi-input default to HDMI over SDI inputs for cards that have both\n");
fprintf(stderr, " --fake-cards-audio make fake (disconnected) cards output a simple tone\n");
- fprintf(stderr, " --v4l-output DEVICE send video (no audio) to V4L2 output/loopback\n");
- fprintf(stderr, " --http-uncompressed-video send uncompressed NV12 video to HTTP clients\n");
+ fprintf(stderr, " --v4l-output=DEVICE send video (no audio) to V4L2 output/loopback\n");
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, " --x264-preset x264 quality preset (default " X264_DEFAULT_PRESET ")\n");
fprintf(stderr, " --x264-tune x264 tuning (default " X264_DEFAULT_TUNE ", can be blank)\n");
fprintf(stderr, " --x264-speedcontrol try to match x264 preset to available CPU speed\n");
- fprintf(stderr, " --x264-speedcontrol-verbose output speedcontrol debugging statistics\n");
fprintf(stderr, " --x264-bitrate x264 bitrate (in kilobit/sec, default %d)\n",
DEFAULT_X264_OUTPUT_BIT_RATE);
- fprintf(stderr, " --x264-crf=VALUE quality-based VBR (-12 to 51), incompatible with --x264-bitrate and VBV\n");
- fprintf(stderr, " --x264-vbv-bufsize x264 VBV size (in kilobits, 0 = one-frame VBV,\n");
- fprintf(stderr, " default: same as --x264-bitrate, that is, one-second VBV)\n");
- 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-crf=VALUE quality-based VBR (-12 to 51), incompatible with --x264-bitrate\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-param=NAME[,VALUE] set any x264 parameter, for fine tuning\n");
}
#ifdef HAVE_AV1
- fprintf(stderr, " --http-av1-video send AV1-compressed video to HTTP clients\n");
+ fprintf(stderr, " --http-av1-video send AV1-compressed video to HTTP clients and SRT output\n");
fprintf(stderr, " --av1-preset SVT-AV1 quality preset (default %d, from -2 to 13)\n",
DEFAULT_AV1_PRESET);
fprintf(stderr, " --av1-bitrate AV1 bitrate (in kilobit/sec, default %d)\n",
fprintf(stderr, " --av1-param=NAME[,VALUE] set any SVT-AV1 parameter, for fine tuning\n");
#endif
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, " --http-audio-codec=NAME audio codec to use for HTTP streams and SRT output\n");
fprintf(stderr, " (default is to use the same as for the recording)\n");
- fprintf(stderr, " --http-audio-bitrate=KBITS audio codec bit rate to use for HTTP streams\n");
+ fprintf(stderr, " --http-audio-bitrate=KBITS audio codec bit rate to use for HTTP streams and SRT output\n");
fprintf(stderr, " (default is %d, ignored unless --http-audio-codec is set)\n",
DEFAULT_AUDIO_OUTPUT_BIT_RATE / 1000);
fprintf(stderr, " --http-port=PORT which port to use for the built-in HTTP server\n");
fprintf(stderr, " (default is %d)\n", DEFAULT_HTTPD_PORT);
+#ifdef HAVE_SRT
fprintf(stderr, " --srt-port=PORT which port to use for receiving SRT streams\n");
fprintf(stderr, " (default is %d)\n", DEFAULT_SRT_PORT);
fprintf(stderr, " --no-srt disable receiving SRT streams\n");
+#endif
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, " --disable-audio do not include any audio in the stream\n");
}
if (program == PROGRAM_NAGERU) {
+#ifdef HAVE_SRT
+ fprintf(stderr, " --srt-destination=HOST:PORT send HTTP video stream also to given destination\n");
+ fprintf(stderr, " --srt-streamid=STREAMID SRT stream identifying ID\n");
+ fprintf(stderr, " --srt-passphrase=PASSPHRASE SRT encryption key\n");
+ fprintf(stderr, " --srt-youtube-stream-key=KEY shortcut for --srt-destination=a.srt.youtube.com:2010\n");
+ fprintf(stderr, " --srt-streamid=#!::u=<KEY>,copy=0,encoder=Nageru\n");
+ fprintf(stderr, " --srt-latency=MS output SRT latency in milliseconds (default is %d)\n", DEFAULT_SRT_OUTPUT_LATENCY_MS);
+#endif
fprintf(stderr, " --flat-audio start with most audio processing turned off\n");
fprintf(stderr, " (can be overridden by e.g. --enable-limiter)\n");
fprintf(stderr, " --gain-staging=DB set initial gain staging to the given value\n");
fprintf(stderr, " --disable-limiter turn off limiter (also --enable)\n");
fprintf(stderr, " --disable-makeup-gain-auto turn off auto-adjustment of final makeup gain (also --enable)\n");
fprintf(stderr, " --disable-alsa-output disable audio monitoring via ALSA\n");
- fprintf(stderr, " --no-flush-pbos do not explicitly signal texture data uploads\n");
- fprintf(stderr, " (will give display corruption, but makes it\n");
- fprintf(stderr, " possible to run with apitrace in real time)\n");
fprintf(stderr, " --print-video-latency print out measurements of video latency on stdout\n");
fprintf(stderr, " --max-input-queue-frames=FRAMES never keep more than FRAMES frames for each card\n");
fprintf(stderr, " (default 6, minimum 1)\n");
{ "default-hdmi-input", no_argument, 0, OPTION_DEFAULT_HDMI_INPUT },
{ "fake-cards-audio", no_argument, 0, OPTION_FAKE_CARDS_AUDIO },
{ "v4l-output", required_argument, 0, OPTION_V4L_OUTPUT },
- { "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 },
- { "x264-speedcontrol-verbose", no_argument, 0, OPTION_X264_SPEEDCONTROL_VERBOSE },
- { "x264-bitrate", required_argument, 0, OPTION_X264_BITRATE },
{ "x264-crf", required_argument, 0, OPTION_X264_CRF },
- { "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 },
{ "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 },
+#ifdef HAVE_SRT
{ "srt-port", required_argument, 0, OPTION_SRT_PORT },
- { "no-srt", no_argument, 0, OPTION_NO_SRT },
+#endif
+ { "no-srt", no_argument, 0, OPTION_NO_SRT }, // We silently allow this even without HAVE_SRT.
+#ifdef HAVE_SRT
+ { "srt-destination", required_argument, 0, OPTION_SRT_DESTINATION },
+ { "srt-streamid", required_argument, 0, OPTION_SRT_STREAMID },
+ { "srt-passphrase", required_argument, 0, OPTION_SRT_PASSPHRASE },
+ { "srt-youtube-stream-key", required_argument, 0, OPTION_SRT_YOUTUBE_STREAM_KEY },
+ { "srt-latency", required_argument, 0, OPTION_SRT_LATENCY },
+#endif
{ "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 },
{ "disable-makeup-gain-auto", no_argument, 0, OPTION_DISABLE_MAKEUP_GAIN_AUTO },
{ "enable-makeup-gain-auto", no_argument, 0, OPTION_ENABLE_MAKEUP_GAIN_AUTO },
{ "disable-alsa-output", no_argument, 0, OPTION_DISABLE_ALSA_OUTPUT },
- { "no-flush-pbos", no_argument, 0, OPTION_NO_FLUSH_PBOS },
{ "print-video-latency", no_argument, 0, OPTION_PRINT_VIDEO_LATENCY },
{ "max-input-queue-frames", required_argument, 0, OPTION_MAX_INPUT_QUEUE_FRAMES },
{ "audio-queue-length-ms", required_argument, 0, OPTION_AUDIO_QUEUE_LENGTH_MS },
{ "input-ycbcr-interpretation", required_argument, 0, OPTION_INPUT_YCBCR_INTERPRETATION },
{ "mjpeg-export-cards", required_argument, 0, OPTION_MJPEG_EXPORT_CARDS },
+ // Do not explicitly signal texture data uploads (will give
+ // display corruption, but makes it possible to run with
+ // apitrace in real time). For developers only, so undocumented.
+ { "no-flush-pbos", no_argument, 0, OPTION_NO_FLUSH_PBOS },
+
+ // Output speedcontrol debugging statistics. For developers only,
+ // so undocumented (users can get this information from Prometheus
+ // statistics, too).
+ { "x264-speedcontrol-verbose", no_argument, 0, OPTION_X264_SPEEDCONTROL_VERBOSE },
+
// Deprecated variants.
{ "10-bit-input", no_argument, 0, OPTION_10_BIT_INPUT },
{ "10-bit-output", no_argument, 0, OPTION_10_BIT_OUTPUT },
case OPTION_V4L_OUTPUT:
global_flags.v4l_output_device = optarg;
break;
- case OPTION_HTTP_UNCOMPRESSED_VIDEO:
- global_flags.uncompressed_video_to_http = true;
- break;
case OPTION_HTTP_MUX:
global_flags.stream_mux_name = optarg;
break;
case OPTION_HTTP_PORT:
global_flags.http_port = atoi(optarg);
break;
+#ifdef HAVE_SRT
case OPTION_SRT_PORT:
global_flags.srt_port = atoi(optarg);
break;
+#endif
case OPTION_NO_SRT:
global_flags.srt_port = -1;
break;
+#ifdef HAVE_SRT
+ case OPTION_SRT_DESTINATION: {
+ const char *ptr = strrchr(optarg, ':');
+ if (ptr == nullptr || strlen(optarg) < 3) {
+ fprintf(stderr, "ERROR: --srt-destination must be of the form host:port\n");
+ exit(1);
+ }
+ global_flags.srt_destination_host = string(optarg, ptr - optarg);
+ if (global_flags.srt_destination_host[0] == '[' &&
+ global_flags.srt_destination_host.back() == ']') {
+ // Support [IPv6]:port, in a sort of hackish way.
+ global_flags.srt_destination_host = global_flags.srt_destination_host.substr(1, global_flags.srt_destination_host.size() - 2);
+ }
+ global_flags.srt_destination_port = ptr + 1;
+ break;
+ }
+ case OPTION_SRT_STREAMID:
+ global_flags.srt_streamid = optarg;
+ break;
+ case OPTION_SRT_PASSPHRASE:
+ global_flags.srt_passphrase = optarg;
+ break;
+ case OPTION_SRT_YOUTUBE_STREAM_KEY:
+ global_flags.srt_destination_host = "a.srt.youtube.com";
+ global_flags.srt_destination_port = "2010";
+ global_flags.srt_streamid = string("#!::u=") + optarg + ",copy=0,encoder=Nageru " NAGERU_VERSION;
+ break;
+ case OPTION_SRT_LATENCY:
+ global_flags.srt_output_latency_ms = atoi(optarg);
+ break;
+#endif
case OPTION_NO_TRANSCODE_VIDEO:
global_flags.transcode_video = false;
break;
case OPTION_X264_CRF:
global_flags.x264_crf = atof(optarg);
break;
- case OPTION_X264_VBV_BUFSIZE:
- global_flags.x264_vbv_buffer_size = atoi(optarg);
- break;
- case OPTION_X264_VBV_MAX_BITRATE:
- global_flags.x264_vbv_max_bitrate = atoi(optarg);
- break;
case OPTION_X264_PARAM:
global_flags.x264_extra_param.push_back(optarg);
break;
}
}
- if (global_flags.uncompressed_video_to_http +
- global_flags.x264_video_to_http +
+ if (global_flags.x264_video_to_http +
global_flags.av1_video_to_http > 1) {
- fprintf(stderr, "ERROR: --http-{uncompressed,x264,av1}-video are mutually incompatible\n");
+ fprintf(stderr, "ERROR: --http-{x264,av1}-video are mutually incompatible\n");
exit(1);
}
if (global_flags.bit_depth == 10) {
global_flags.x264_video_to_http = true;
}
}
- if (global_flags.x264_video_to_disk && !global_flags.uncompressed_video_to_http && !global_flags.av1_video_to_http) {
+ if (global_flags.x264_video_to_disk && !global_flags.av1_video_to_http) {
global_flags.x264_video_to_http = true; // Quick Sync to HTTP but x264 to disk doesn't make sense.
}
if (global_flags.min_num_cards <= 0) {
fprintf(stderr, "ERROR: --x264-bitrate and --x264-crf are mutually incompatible.\n");
exit(1);
}
- if (global_flags.x264_vbv_max_bitrate != -1 && global_flags.x264_vbv_buffer_size != -1) {
- fprintf(stderr, "WARNING: VBV settings are ignored with --x264-crf.\n");
- }
} else if (global_flags.x264_bitrate == -1) {
global_flags.x264_bitrate = DEFAULT_X264_OUTPUT_BIT_RATE;
}
global_flags.card_to_mjpeg_stream_export[card_idx] = card_idx;
}
}
+
+ if (global_flags.srt_destination_host == "a.srt.youtube.com" && global_flags.srt_passphrase.empty()) {
+ fprintf(stderr, "ERROR: Cannot stream to YouTube without --srt-passphrase (get it from the YouTube streaming console)\n");
+ exit(1);
+ }
}