Implement ffmpeg building
This commit is contained in:
parent
a31bd84eaa
commit
956c8f3a20
1 changed files with 53 additions and 0 deletions
53
types/ffmpeg.go
Normal file
53
types/ffmpeg.go
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
package types
|
||||||
|
|
||||||
|
type FFmpegCommand struct {
|
||||||
|
Args []Arg `json:"args"`
|
||||||
|
InputFiles []File `json:"input_files"`
|
||||||
|
OutputFiles []File `json:"output_files"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type File struct {
|
||||||
|
Path string `json:"path"`
|
||||||
|
Arguments []Arg `json:"args"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Arg struct {
|
||||||
|
Flag string `json:"flag"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FFmpegCommand) GetArgs() []string {
|
||||||
|
args := []string{}
|
||||||
|
|
||||||
|
for _, a := range c.Args {
|
||||||
|
args = append(args, a.Flag)
|
||||||
|
if a.Value != "" {
|
||||||
|
args = append(args, a.Value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, i := range c.InputFiles {
|
||||||
|
for _, a := range i.Arguments {
|
||||||
|
args = append(args, a.Flag)
|
||||||
|
if a.Value != "" {
|
||||||
|
args = append(args, a.Value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args = append(args, "-i", i.Path)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, i := range c.OutputFiles {
|
||||||
|
for _, a := range i.Arguments {
|
||||||
|
args = append(args, a.Flag)
|
||||||
|
if a.Value != "" {
|
||||||
|
args = append(args, a.Value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args = append(args, i.Path)
|
||||||
|
}
|
||||||
|
|
||||||
|
return args
|
||||||
|
}
|
||||||
|
|
||||||
|
// ffmpeg -loglevel error -stats
|
||||||
|
// ffmpeg.exe -stats -v error -i "in.mp4" -f null -max_muxing_queue_size 9999 "out.mp4"
|
Loading…
Add table
Reference in a new issue