53 lines
1 KiB
Go
53 lines
1 KiB
Go
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"
|