Add default video settings if none are provided

This commit is contained in:
Gabe Kangas 2020-07-11 18:31:28 -07:00
parent 873e2535f8
commit 2bd016ae15
2 changed files with 11 additions and 11 deletions

View file

@ -37,17 +37,10 @@ videoSettings:
offlineContent: static/offline.m4v # Is displayed when a stream ends
streamQualities:
# Pass through the exact video and audio that you're streaming.
- full:
videoPassthrough: true
audioPassthrough: true
# Transcode the video to a lower bitrate and resize
# - low:
# videoBitrate: 700
# scaledWidth: 600
# audioPassthrough: true
# encoderPreset: superfast
- medium:
videoBitrate: 800
encoderPreset: superfast
files:
maxNumberInPlaylist: 30

View file

@ -192,7 +192,14 @@ func NewTranscoder() Transcoder {
transcoder.input = utils.GetTemporaryPipePath()
transcoder.segmentLengthSeconds = config.Config.VideoSettings.ChunkLengthInSeconds
for index, quality := range config.Config.VideoSettings.StreamQualities {
qualities := config.Config.VideoSettings.StreamQualities
if len(qualities) == 0 {
defaultQuality := config.StreamQuality{}
defaultQuality.VideoBitrate = 1000
defaultQuality.EncoderPreset = "superfast"
qualities = append(qualities, defaultQuality)
}
for index, quality := range qualities {
variant := getVariantFromConfigQuality(quality, index)
transcoder.AddVariant(variant)
}