github.com/noriah/catnip@v1.8.5/input/ffmpeg/ffmpeg.go (about) 1 package ffmpeg 2 3 import ( 4 "fmt" 5 6 "github.com/noriah/catnip/input" 7 "github.com/noriah/catnip/input/common/execread" 8 ) 9 10 type FFmpegBackend interface { 11 InputArgs() []string 12 } 13 14 func NewSession(b FFmpegBackend, cfg input.SessionConfig) (*execread.Session, error) { 15 args := []string{"ffmpeg", "-hide_banner", "-loglevel", "panic"} 16 args = append(args, b.InputArgs()...) 17 args = append(args, 18 "-ar", fmt.Sprintf("%.0f", cfg.SampleRate), 19 "-ac", fmt.Sprintf("%d", cfg.FrameSize), 20 "-f", "f64le", 21 "-", 22 ) 23 24 return execread.NewSession(args, false, cfg), nil 25 }