summaryrefslogtreecommitdiff
path: root/bin/capture+encode+serve
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-04-26 13:16:02 +0200
committerJonas Smedegaard <dr@jones.dk>2017-04-26 13:44:20 +0200
commit78a005809f830b8f9133c61ad45e7446f4e0f63a (patch)
treea1aac3f71413da25f614520aa72dcf3f6ce062e9 /bin/capture+encode+serve
parentb87b680ca361322d1066ecf40216a60a77e50699 (diff)
Merge and rename hash-of-array variables %VFORMAT %AFORMAT → %PIPELINE.
Diffstat (limited to 'bin/capture+encode+serve')
-rwxr-xr-xbin/capture+encode+serve25
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);