feat: add gopsize option

This commit is contained in:
Alf
2022-07-26 19:59:45 -07:00
parent 72131f7c77
commit e8f2661534
2 changed files with 11 additions and 3 deletions

View File

@@ -24,9 +24,9 @@ const (
██╔══╝ ██╔══╝ ██║╚██╔╝██║██╔═══╝ ██╔══╝ ██║ ██║██║ ██║
██║ ██║ ██║ ╚═╝ ██║██║ ███████╗╚██████╔╝██████╔╝
╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚══════╝ ╚═════╝ ╚═════╝
v0.0.8
v0.1.0
`
version = "ffmpegd version 0.0.8"
version = "ffmpegd version 0.1.0"
description = "[\u001b[32mffmpegd\u001b[0m] - websocket server for \u001b[33mffmpeg-commander\u001b[0m.\n"
usage = `
Usage:
@@ -191,7 +191,9 @@ func handleFiles(w http.ResponseWriter, r *http.Request) {
Files: []file{},
}
files, _ := ioutil.ReadDir(cleanPath(prefix))
base, _ := filepath.Abs(".")
cleaned := filepath.Join(base, cleanPath(prefix))
files, _ := ioutil.ReadDir(cleaned)
for _, f := range files {
if f.IsDir() {
if prefix == "." {

View File

@@ -70,6 +70,7 @@ type videoOptions struct {
MinRate string `json:"minrate"`
MaxRate string `json:"maxrate"`
BufSize string `json:"bufsize"`
GopSize string `json:"gopsize"`
PixelFormat string `json:"pixel_format"`
FrameRate string `json:"frame_rate"`
Speed string `json:"speed"`
@@ -335,6 +336,11 @@ func setVideoFlags(opt videoOptions) []string {
args = append(args, []string{"-bufsize", opt.BufSize}...)
}
// GOP size.
if opt.GopSize != "" && opt.GopSize != "0" {
args = append(args, []string{"-g", opt.GopSize}...)
}
// Pixel Format.
if opt.PixelFormat != "" && opt.PixelFormat != "auto" {
args = append(args, []string{"-pix_fmt", opt.PixelFormat}...)