summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-05-19 11:44:26 +0200
committerJonas Smedegaard <dr@jones.dk>2017-05-19 11:44:26 +0200
commitdde6df18d4f0a183f8b68c9d0314a080d2f3fe13 (patch)
treedc45ba467f4b7739bb3b6e2365b8e737dec3fe97
parentf29540d0eb313883ab5954f09e9b361ff7a943ca (diff)
Fix misc. bugs in recent edits.
-rwxr-xr-xbin/capture+encode+serve12
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/capture+encode+serve b/bin/capture+encode+serve
index 9c78374..4061595 100755
--- a/bin/capture+encode+serve
+++ b/bin/capture+encode+serve
@@ -56,12 +56,13 @@ my $RATIO_DEN = 3;
# + best (i.e. high-modulo) 4:3 heights: 288 312 384 480 624 816
# * speeds tuned to just below 100% cpu usage for each combination on a multi-core computer
# TODO: Externalize speeds to site-specific configfile
-my ( $VBITRATE, $SPEED_X264, $SPEED_X264_ALONE, $SPEED_VP8,
- $SPEED_VP8_ALONE );
+my ($VBITRATE, $SPEED_X264, $SPEED_X264_ALONE, $SPEED_VP8,
+ $SPEED_VP8_ALONE
+);
$RATIO_NUM ||= 16;
$RATIO_DEN ||= 9;
my $WIDTH ||= $HEIGHT * $RATIO_NUM / $RATIO_DEN;
-$BITS = $WIDTH * $HEIGHT;
+my $BITS = $WIDTH * $HEIGHT;
if ( $BITS le 110592 ) { # 234p → 97344
$VBITRATE = 145000;
@@ -103,7 +104,8 @@ elsif ( $BITS le 921600 ) { # 720p → 921600
$SPEED_X264_ALONE = 'ultrafast';
$SPEED_VP8_ALONE = 15;
}
-if ( toofast == $SPEED_X264 ) die "Not enough CPU - reduce size or streams";
+die "Not enough CPU - reduce size or streams"
+ if ( $SPEED_X264 eq 'toofast' );
# TODO: implement codec-specific height pools
#if ( toofast == $SPEED_X264 ) { @HEIGHTS_MPEG = () };
@@ -128,7 +130,7 @@ my %PIPELINE = (
# * let x264 use low-latency sliced-threads (i.e. don't disable treads)
VENC => [
- "x264enc speed-preset=$SPEED_H264 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\"",
+ "x264enc speed-preset=$SPEED_X264 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',