Added streaming quality options (#790)

This commit is contained in:
JoeSmithStarkers
2020-10-22 15:02:27 +11:00
committed by GitHub
parent a31c8ccd33
commit 71c814c116
5 changed files with 157 additions and 33 deletions

View File

@@ -145,6 +145,7 @@ func (rs sceneRoutes) streamTranscode(w http.ResponseWriter, r *http.Request, vi
// start stream based on query param, if provided
r.ParseForm()
startTime := r.Form.Get("start")
requestedSize := r.Form.Get("resolution")
var stream *ffmpeg.Stream
@@ -156,6 +157,9 @@ func (rs sceneRoutes) streamTranscode(w http.ResponseWriter, r *http.Request, vi
options := ffmpeg.GetTranscodeStreamOptions(*videoFile, videoCodec, audioCodec)
options.StartTime = startTime
options.MaxTranscodeSize = config.GetMaxStreamingTranscodeSize()
if requestedSize != "" {
options.MaxTranscodeSize = models.StreamingResolutionEnum(requestedSize)
}
encoder := ffmpeg.NewEncoder(manager.GetInstance().FFMPEGPath)
stream, err = encoder.GetTranscodeStream(options)