From 4cf5f65c2eb911b3f94cbbaa8480b588173a3fd8 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Tue, 16 May 2017 13:35:44 +0200 Subject: Resolve bitrate based on height. --- bin/capture+encode+serve | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'bin/capture+encode+serve') 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"; -- cgit v1.2.3