Add basic live transcoding to webm

This commit is contained in:
WithoutPants
2019-07-25 08:17:22 +10:00
parent a9c21cb1dc
commit 22577918fb
3 changed files with 83 additions and 2 deletions

View File

@@ -1,5 +1,10 @@
package ffmpeg
import (
"io"
"os"
)
type TranscodeOptions struct {
OutputPath string
}
@@ -20,3 +25,18 @@ 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{
"-i", probeResult.Path,
"-c:v", "libvpx-vp9",
"-vf", "scale=iw:-2",
"-deadline", "realtime",
"-cpu-used", "5",
"-crf", "30",
"-b:v", "0",
"-f", "webm",
"pipe:",
}
return e.stream(probeResult, args)
}