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,10 +1,13 @@
package ffmpeg
import (
"github.com/stashapp/stash/pkg/logger"
"io"
"io/ioutil"
"os"
"os/exec"
"strings"
"github.com/stashapp/stash/pkg/logger"
)
type Encoder struct {
@@ -60,3 +63,18 @@ func (e *Encoder) run(probeResult VideoFile, args []string) (string, error) {
return stdoutString, nil
}
func (e *Encoder) stream(probeResult VideoFile, args []string) (io.ReadCloser, *os.Process, error) {
cmd := exec.Command(e.Path, args...)
stdout, err := cmd.StdoutPipe()
if nil != err {
logger.Error("FFMPEG stdout not available: " + err.Error())
}
if err = cmd.Start(); err != nil {
return nil, nil, err
}
return stdout, cmd.Process, nil
}