mirror of
https://github.com/u2takey/ffmpeg-go.git
synced 2025-10-05 16:06:52 +08:00
Merge pull request #65 from banana-framework-lab/banana-patch-1
U In version 1.19, ffmpeg in the current directory cannot be used aut…
This commit is contained in:
22
node.go
22
node.go
@@ -10,11 +10,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Stream struct {
|
type Stream struct {
|
||||||
Node *Node
|
Node *Node
|
||||||
Label Label
|
Label Label
|
||||||
Selector Selector
|
Selector Selector
|
||||||
Type string
|
Type string
|
||||||
Context context.Context
|
FfmpegPath string
|
||||||
|
Context context.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
type RunHook struct {
|
type RunHook struct {
|
||||||
@@ -27,11 +28,12 @@ type RunHook struct {
|
|||||||
|
|
||||||
func NewStream(node *Node, streamType string, label Label, selector Selector) *Stream {
|
func NewStream(node *Node, streamType string, label Label, selector Selector) *Stream {
|
||||||
return &Stream{
|
return &Stream{
|
||||||
Node: node,
|
Node: node,
|
||||||
Label: label,
|
Label: label,
|
||||||
Selector: selector,
|
Selector: selector,
|
||||||
Type: streamType,
|
Type: streamType,
|
||||||
Context: context.Background(),
|
FfmpegPath: "ffmpeg",
|
||||||
|
Context: context.Background(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
run.go
7
run.go
@@ -248,10 +248,15 @@ func SeparateProcessGroup() CompilationOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Stream) SetFfmpegPath(path string) *Stream {
|
||||||
|
s.FfmpegPath = path
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
// for test
|
// for test
|
||||||
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, "ffmpeg", args...)
|
cmd := exec.CommandContext(s.Context, s.FfmpegPath, args...)
|
||||||
if a, ok := s.Context.Value("Stdin").(io.Reader); ok {
|
if a, ok := s.Context.Value("Stdin").(io.Reader); ok {
|
||||||
cmd.Stdin = a
|
cmd.Stdin = a
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user