Add seeking for live transcodes via video.js

This commit is contained in:
WithoutPants
2019-07-29 13:42:00 +10:00
parent 4f016ab3c9
commit 8ed3c5f71d
6 changed files with 336 additions and 22 deletions

View File

@@ -26,8 +26,14 @@ func (e *Encoder) Transcode(probeResult VideoFile, options TranscodeOptions) {
_, _ = e.run(probeResult, args)
}
func (e *Encoder) StreamTranscode(probeResult VideoFile) (io.ReadCloser, *os.Process, error) {
args := []string{
func (e *Encoder) StreamTranscode(probeResult VideoFile, startTime string) (io.ReadCloser, *os.Process, error) {
args := []string{}
if startTime != "" {
args = append(args, "-ss", startTime)
}
args = append(args,
"-i", probeResult.Path,
"-c:v", "libvpx-vp9",
"-vf", "scale=iw:-2",
@@ -37,6 +43,7 @@ func (e *Encoder) StreamTranscode(probeResult VideoFile) (io.ReadCloser, *os.Pro
"-b:v", "0",
"-f", "webm",
"pipe:",
}
)
return e.stream(probeResult, args)
}