Add: support video (still in test), change ogg to webm

This commit is contained in:
2021-12-16 00:51:32 +08:00
parent fc735c88d3
commit 465517e5cc
7 changed files with 75 additions and 53 deletions

View File

@@ -68,7 +68,7 @@ func (api *API) HandleGetFileStream(w http.ResponseWriter, r *http.Request) {
}
args := strings.Split(ffmpegConfig.Args, " ")
startArgs := []string{"-threads", strconv.FormatInt(api.APIConfig.FfmpegThreads, 10), "-i", path}
endArgs := []string{"-vn", "-f", "ogg", "-"}
endArgs := []string{"-f", "webm", "-"}
ffmpegArgs := append(startArgs, args...)
ffmpegArgs = append(ffmpegArgs, endArgs...)
cmd := exec.Command("ffmpeg", ffmpegArgs...)
@@ -137,7 +137,7 @@ func (api *API) HandlePrepareFileStreamDirect(w http.ResponseWriter, r *http.Req
args := strings.Split(ffmpegConfig.Args, " ")
startArgs := []string{"-threads", strconv.FormatInt(api.APIConfig.FfmpegThreads, 10), "-i", srcPath}
endArgs := []string{"-vn", "-y", objPath}
endArgs := []string{"-y", objPath}
ffmpegArgs := append(startArgs, args...)
ffmpegArgs = append(ffmpegArgs, endArgs...)
cmd := exec.Command("ffmpeg", ffmpegArgs...)

View File

@@ -17,7 +17,7 @@ type Tmpfs struct {
}
func (tmpfs *Tmpfs) GetObjFilePath(id int64, configName string) (string) {
return filepath.Join(tmpfs.Config.Root, strconv.FormatInt(id, 10) + "." + configName + ".ogg")
return filepath.Join(tmpfs.Config.Root, strconv.FormatInt(id, 10) + "." + configName + ".webm")
}
func (tmpfs *Tmpfs) GetLock(filename string) *sync.Mutex {