Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputOptions help #7

Closed
BrennaEpp opened this issue Jul 13, 2021 · 1 comment
Closed

InputOptions help #7

BrennaEpp opened this issue Jul 13, 2021 · 1 comment

Comments

@BrennaEpp
Copy link

BrennaEpp commented Jul 13, 2021

Hi, I'm not sure whether this is not working or if I am doing it wrong. I want to pass in options so I can trim the video.

Here is the code:

	buf := &bytes.Buffer{}
	err := fluentffmpeg.NewCommand("./ffmpeg-binaries/ffmpeg").
		InputOptions("-ss 00:00:10").
		InputPath("./video.mp4").
		OutputFormat("mp4").
		OutputPath("./trim.mp4").
		Overwrite(true).
		OutputLogs(buf).
		Run()

	if err != nil {
		log.Fatal(err)
	}

This returns exit status 1.

The above does not return an error if InputOptions is empty, but even InputOptions("") returns an error. Is this working as intended?

@zackradisic
Copy link
Member

Hi @BrennaEpp, you need to separate the input options into multiple strings or ffmpeg will interpret "-ss 00:00:10" literally as one argument.

// FFmpeg returns: Unrecognized option 'ss 00:00:10'
fluentffmpeg.NewCommand("").InputOptions("-ss 00:00:10").OutputPath("./trim.mp4")

// Works
fluentffmpeg.NewCommand("").InputOptions("-ss", "00:00:10").OutputPath("./trim.mp4")

In the future you can also read from the buffer you supplied to OutputLogs to get a more descriptive error straight from ffmpeg 👍

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

No branches or pull requests

2 participants