Skip to content

Commit

Permalink
feat: add gopsize option
Browse files Browse the repository at this point in the history
  • Loading branch information
alfg committed Jul 27, 2022
1 parent 72131f7 commit e8f2661
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/ffmpegd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 == "." {
Expand Down
6 changes: 6 additions & 0 deletions ffmpeg/ffmpeg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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}...)
Expand Down

0 comments on commit e8f2661

Please # to comment.