mirror of
https://github.com/u2takey/ffmpeg-go.git
synced 2025-10-06 08:27:06 +08:00
added method to disable the logging of the compiled ffmpeg command
This commit is contained in:
9
run.go
9
run.go
@@ -253,7 +253,12 @@ func (s *Stream) SetFfmpegPath(path string) *Stream {
|
|||||||
return s
|
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 {
|
func (s *Stream) Compile(options ...CompilationOption) *exec.Cmd {
|
||||||
args := s.GetArgs()
|
args := s.GetArgs()
|
||||||
cmd := exec.CommandContext(s.Context, s.FfmpegPath, args...)
|
cmd := exec.CommandContext(s.Context, s.FfmpegPath, args...)
|
||||||
@@ -269,7 +274,9 @@ func (s *Stream) Compile(options ...CompilationOption) *exec.Cmd {
|
|||||||
for _, option := range options {
|
for _, option := range options {
|
||||||
option(s, cmd)
|
option(s, cmd)
|
||||||
}
|
}
|
||||||
|
if LogCompiledCommand {
|
||||||
log.Printf("compiled command: ffmpeg %s\n", strings.Join(args, " "))
|
log.Printf("compiled command: ffmpeg %s\n", strings.Join(args, " "))
|
||||||
|
}
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user