Merge pull request #81 from Kirari04/master

Suppress compiled command
This commit is contained in:
leiiwang
2023-03-12 13:48:08 +08:00
committed by GitHub

14
run.go
View File

@@ -247,7 +247,12 @@ func (s *Stream) SetFfmpegPath(path string) *Stream {
return s
}
// for test
var LogCompiledCommand bool = true
func (s *Stream) Silent(isSilent bool) *Stream {
LogCompiledCommand = !isSilent
return s
}
func (s *Stream) Compile(options ...CompilationOption) *exec.Cmd {
args := s.GetArgs()
cmd := exec.CommandContext(s.Context, s.FfmpegPath, args...)
@@ -260,13 +265,12 @@ func (s *Stream) Compile(options ...CompilationOption) *exec.Cmd {
if a, ok := s.Context.Value("Stderr").(io.Writer); ok {
cmd.Stderr = a
}
for _, option := range options {
option(s, cmd)
}
for _, option := range GlobalCommandOptions {
option(cmd)
}
log.Printf("compiled command: ffmpeg %s\n", strings.Join(args, " "))
if LogCompiledCommand {
log.Printf("compiled command: ffmpeg %s\n", strings.Join(args, " "))
}
return cmd
}