diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/capture+encode+serve | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/bin/capture+encode+serve b/bin/capture+encode+serve index c545d45..6a6da0d 100755 --- a/bin/capture+encode+serve +++ b/bin/capture+encode+serve @@ -59,31 +59,26 @@ my $ABUFFERS = 20000; # * generous queue sizes inspired by https://wiki.xiph.org/GST_cookbook my $QUEUE = "queue max-size-bytes=100000000 max-size-time=0"; -my %VFORMAT = ( +my %PIPELINE = ( + AMR => { + AENC => "amrnbenc ! $QUEUE ! rtpamrpay", + }, H264 => { # * let x264 use low-latency sliced-threads (i.e. don't disable treads) VENC => "x264enc speed-preset=ultrafast tune=zerolatency bitrate=800 byte-stream=true key-int-max=15 intra-refresh=true option-string=\"slice-max-size=8192:vbv-maxrate=80:vbv-bufsize=10\" ! video/x-h264,profile=baseline ! $QUEUE ! rtph264pay", }, + OPUS => { + AENC => "opusenc ! $QUEUE ! rtpopuspay", + }, VP8 => { VENC => "vp8enc threads=4 cpu-used=15 deadline=1000000 end-usage=1 target-bitrate=$VBITRATE undershoot=95 keyframe-max-dist=999999 max-quantizer=56 deadline=5000 static-threshold=500 ! video/x-vp8 ! $QUEUE ! rtpvp8pay", }, RAW => { - VENC => "rtpvrawpay", - }, -); - -my %AFORMAT = ( - AMR => { - AENC => "amrnbenc ! $QUEUE ! rtpamrpay", - }, - OPUS => { - AENC => "opusenc ! $QUEUE ! rtpopuspay", - }, - RAW => { AENC => "rtpL16pay", + VENC => "rtpvrawpay", }, ); @@ -96,7 +91,7 @@ sub cam my $factory = Gst::RTSPMediaFactory->new(); $factory->set_launch( - "( v4l2src device=$device ! $QUEUE ! videoconvert ! $VCAPS ! $QUEUE ! $VFORMAT{$VFORMAT}{'VENC'} name=$payload )" + "( v4l2src device=$device ! $QUEUE ! videoconvert ! $VCAPS ! $QUEUE ! $PIPELINE{$VFORMAT}{'VENC'} name=$payload )" ); $factory->set_shared(TRUE); say "media ($device): " . $factory->get_launch(); @@ -114,7 +109,7 @@ sub mic my $factory = Gst::RTSPMediaFactory->new(); $factory->set_launch( - "( alsasrc device=$device buffer-time=$ABUFFERS ! $QUEUE ! audioconvert ! $QUEUE ! $AFORMAT{$AFORMAT}{'AENC'} name=$payload )" + "( alsasrc device=$device buffer-time=$ABUFFERS ! $QUEUE ! audioconvert ! $QUEUE ! $PIPELINE{$AFORMAT}{'AENC'} name=$payload )" ); $factory->set_shared(TRUE); |