fluent-ffmpeg / node-fluent-ffmpeg

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

Forward options to ffprobe #1146

Open Bec-k opened 2 years ago

Bec-k commented 2 years ago

I see that there are options available in the code, but not in docs and these options are not used anywhere. Forward probe options anyhow from external/public api.

var ffprobe = spawn(path, ['-show_streams', '-show_format'].concat(options, src));

This part: .concat(options

Options should be set somehow and forwarded to ffprobe.

I want to forward /usr/bin/ffprobe -rtsp_transport tcp -show_streams -show_format rtsp://...

This option -rtsp_transport tcp

laggingreflex commented 2 years ago

Input Options? .input(rtsp://...).inputOptions(['-rtsp_transport tcp'])

khanzzirfan commented 1 year ago

Yes, this is required. FFprobe only returns meta data. but It is not taking any input options. For example, how could I achieve this using the library

ffprobe -i in.mp4 -show_entries packet=pos,pts_time,flags -select_streams v -of compact=p=0:nk=1 -v 0
Endain commented 4 months ago

I had a similar issue plaguing me for quite some time. 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 you 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) => { ... });

This difference in behavior should probably be documented somewhere, or, as OP mentioned, it would be nice if our options were forwarded to the probe command.