summaryrefslogtreecommitdiff
path: root/bin/capture+encode+serve
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-05-16 13:35:44 +0200
committerJonas Smedegaard <dr@jones.dk>2017-05-16 13:46:54 +0200
commit4cf5f65c2eb911b3f94cbbaa8480b588173a3fd8 (patch)
treed1b704a64eed7e4ad1b7fd7b5b454be7d101c0a0 /bin/capture+encode+serve
parent3822b5e619e06c0da03ab56f77a008ecafcb944d (diff)
Resolve bitrate based on height.
Diffstat (limited to 'bin/capture+encode+serve')
-rwxr-xr-xbin/capture+encode+serve10
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/capture+encode+serve b/bin/capture+encode+serve
index e3fce44..83af18c 100755
--- a/bin/capture+encode+serve
+++ b/bin/capture+encode+serve
@@ -47,7 +47,15 @@ my $HEIGHT = 240;
my $FRAMERATE = 25;
my $AUDIORATE = 48000;
-my $VBITRATE = 256000;
+my $VBITRATE;
+
+# inspired by Apple HLS recommendations
+if ( $HEIGHT le 234 ) { $VBITRATE = 145000 }
+elsif ( $HEIGHT le 270 ) { $VBITRATE = 365000 }
+elsif ( $HEIGHT le 360 ) { $VBITRATE = 730000 }
+elsif ( $HEIGHT le 432 ) { $VBITRATE = 1100000 }
+elsif ( $HEIGHT le 540 ) { $VBITRATE = 2000000 }
+elsif ( $HEIGHT le 720 ) { $VBITRATE = 3000000 }
my $VCAPS = "video/x-raw,height=$HEIGHT";
my $ACAPS = "audio/x-raw,rate=$AUDIORATE,channels=2,depth=16";