More tuning

monorepo
Varun Patil 2022-11-12 02:39:56 -08:00
parent 5b5a5afe78
commit 22e6715b2a
2 changed files with 12 additions and 8 deletions

View File

@ -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))) m.numChunks = int(math.Ceil(m.probe.Duration.Seconds() / float64(c.chunkSize)))
// Possible streams // 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["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["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: 4500000} 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: 9000000} 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: 14000000} 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 // Only keep streams that are smaller than the video
var highest int var highest int

View File

@ -317,8 +317,12 @@ func (s *Stream) transcode(startId int) {
"-profile:v", "high", "-profile:v", "high",
}...) }...)
// Extra args only for x264 // Device specific output args
if !VAAPI { if VAAPI {
args = append(args, []string{
"-low_power", "1",
}...)
} else {
args = append(args, []string{ args = append(args, []string{
"-preset", "faster", "-preset", "faster",
"-level:v", "4.0", "-level:v", "4.0",
@ -342,7 +346,7 @@ func (s *Stream) transcode(startId int) {
"-avoid_negative_ts", "disabled", "-avoid_negative_ts", "disabled",
"-f", "hls", "-f", "hls",
"-hls_time", fmt.Sprintf("%d", s.c.chunkSize), "-hls_time", fmt.Sprintf("%d", s.c.chunkSize),
"-g", fmt.Sprintf("%d", s.c.chunkSize), "-g", "64", "-keyint_min", "64",
"-hls_segment_type", "mpegts", "-hls_segment_type", "mpegts",
"-start_number", fmt.Sprintf("%d", startId), "-start_number", fmt.Sprintf("%d", startId),
"-hls_segment_filename", s.getTsPath(-1), "-hls_segment_filename", s.getTsPath(-1),