From 22e6715b2afbbef369f9731dda07cf56421448ae Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sat, 12 Nov 2022 02:39:56 -0800 Subject: [PATCH] More tuning --- manager.go | 10 +++++----- stream.go | 10 +++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/manager.go b/manager.go index 3f729970..3100c32b 100644 --- a/manager.go +++ b/manager.go @@ -58,12 +58,12 @@ func NewManager(c *Config, path string, id string, close chan string) (*Manager, m.numChunks = int(math.Ceil(m.probe.Duration.Seconds() / float64(c.chunkSize))) // Possible streams - m.streams["360p"] = &Stream{c: c, m: m, quality: "360p", height: 360, width: 640, bitrate: 750000} + m.streams["360p"] = &Stream{c: c, m: m, quality: "360p", height: 360, width: 640, bitrate: 500000} m.streams["480p"] = &Stream{c: c, m: m, quality: "480p", height: 480, width: 640, bitrate: 1000000} - m.streams["720p"] = &Stream{c: c, m: m, quality: "720p", height: 720, width: 1280, bitrate: 2500000} - m.streams["1080p"] = &Stream{c: c, m: m, quality: "1080p", height: 1080, width: 1920, bitrate: 4500000} - m.streams["1440p"] = &Stream{c: c, m: m, quality: "1440p", height: 1440, width: 2560, bitrate: 9000000} - m.streams["2160p"] = &Stream{c: c, m: m, quality: "2160p", height: 2160, width: 3840, bitrate: 14000000} + m.streams["720p"] = &Stream{c: c, m: m, quality: "720p", height: 720, width: 1280, bitrate: 2000000} + m.streams["1080p"] = &Stream{c: c, m: m, quality: "1080p", height: 1080, width: 1920, bitrate: 3500000} + m.streams["1440p"] = &Stream{c: c, m: m, quality: "1440p", height: 1440, width: 2560, bitrate: 6000000} + m.streams["2160p"] = &Stream{c: c, m: m, quality: "2160p", height: 2160, width: 3840, bitrate: 10000000} // Only keep streams that are smaller than the video var highest int diff --git a/stream.go b/stream.go index 1a904b04..03c5d51b 100644 --- a/stream.go +++ b/stream.go @@ -317,8 +317,12 @@ func (s *Stream) transcode(startId int) { "-profile:v", "high", }...) - // Extra args only for x264 - if !VAAPI { + // Device specific output args + if VAAPI { + args = append(args, []string{ + "-low_power", "1", + }...) + } else { args = append(args, []string{ "-preset", "faster", "-level:v", "4.0", @@ -342,7 +346,7 @@ func (s *Stream) transcode(startId int) { "-avoid_negative_ts", "disabled", "-f", "hls", "-hls_time", fmt.Sprintf("%d", s.c.chunkSize), - "-g", fmt.Sprintf("%d", s.c.chunkSize), + "-g", "64", "-keyint_min", "64", "-hls_segment_type", "mpegts", "-start_number", fmt.Sprintf("%d", startId), "-hls_segment_filename", s.getTsPath(-1),