fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.97k stars 881 forks source link

Document how to set input options when using ffprobe #1246

Open Endain opened 10 months ago

Endain commented 10 months ago

I needed to probe a remote video that required authorization, but ffprobe would not respect the input options I was passing. It turns out that ffprobe does not receive any of the input options set up in the command, instead, you must pass them in the ffprobe() call.

For example, if you do this:

const cmd = ffmpeg();
cmd.input(url);
cmd.inputOption([`-headers`, `Authorization: Bearer ${some_token}`]);
cmd.ffprobe((err, data) => { ... });

Then the code will silently ignore anything you have set using inputOption();

What you must do instead is pass your additional options as a parameter to the ffprobe() call. This will do what I originally intended:

const cmd = ffmpeg();
cmd.input(url);
cmd.ffprobe([`-headers`, `Authorization: Bearer ${some_token}`], (err, data) => { ... });

I could not find this difference in behavior documented anywhere in the docs. It would be nice if the documentation could be updated, or if our options were forwarded to the probe command.