diff --git a/manager.go b/manager.go index 919eaa35..3f729970 100644 --- a/manager.go +++ b/manager.go @@ -58,10 +58,10 @@ 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: 800000} - m.streams["480p"] = &Stream{c: c, m: m, quality: "480p", height: 480, width: 640, bitrate: 1500000} - m.streams["720p"] = &Stream{c: c, m: m, quality: "720p", height: 720, width: 1280, bitrate: 3000000} - m.streams["1080p"] = &Stream{c: c, m: m, quality: "1080p", height: 1080, width: 1920, bitrate: 5000000} + m.streams["360p"] = &Stream{c: c, m: m, quality: "360p", height: 360, width: 640, bitrate: 750000} + 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} diff --git a/stream.go b/stream.go index 0a24656c..1a904b04 100644 --- a/stream.go +++ b/stream.go @@ -307,8 +307,7 @@ func (s *Stream) transcode(startId int) { if s.quality != "max" { args = append(args, []string{ "-vf", scale, - "-maxrate", fmt.Sprintf("%dk", s.bitrate/1000), - "-bufsize", fmt.Sprintf("%dK", s.bitrate/3000), + "-b:v", fmt.Sprintf("%dk", s.bitrate/1000), }...) } @@ -327,9 +326,15 @@ func (s *Stream) transcode(startId int) { } // Audio + ab := "192k" + if s.bitrate < 1000000 { + ab = "64k" + } else if s.bitrate < 3000000 { + ab = "128k" + } args = append(args, []string{ "-c:a", "aac", - "-b:a", "192k", + "-b:a", ab, }...) // Segmenting specs