Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.

Piping Example #6

Open
thewalrusisben opened this issue Aug 15, 2020 · 2 comments
Open

Piping Example #6

thewalrusisben opened this issue Aug 15, 2020 · 2 comments

Comments

@thewalrusisben
Copy link

Hey there, just wondering if it would be possible to provide a minimal example of how to use the InputPipe / OutputPipe methods available. I've been trying to use them but am not totally sure how the readers and writers are supposed to be set up.

Thank you!

@meandrewdev
Copy link

meandrewdev commented Aug 27, 2020

type DiscardCloser struct {
	io.Writer
}

func (DiscardCloser) Close() error { return nil }

rc := ioutil.NopCloser(input)
var wc io.WriteCloser = &DiscardCloser{}
progress, err := ffmpeg.
		New(ffmpegConf).
		InputPipe(&wc, &rc).
		Output(output).
		WithOptions(opts).
		Start(opts)

This code generating error "missing input option"

@Mran
Copy link

Mran commented Sep 1, 2020

@thewalrusisben @confirm2315

cmd := exec.Command("ffmpeg", "-i", path, "-ss", sTime, "-t", "3", "-vn", "-f", "mp3", "pipe:")

r, _ := cmd.StdoutPipe()

_ = cmd.Start()

bb, _ := ioutil.ReadAll(r)

I readed his code, seems not support pipe yet

this is my code.
just notice the argument "-f",and "pipe:"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants