Skip to content

Streams Limitations

FedericoCarboni edited this page Nov 2, 2020 · 3 revisions

Limitations

There is no hard limit on how many streams can be used simultaneously in inputs and outputs. However, some formats have specific requirements for inputs and/or outputs so they can't be used in streams. For example, you might expect the following snippet to work, but it fails.

const cmd = ffmpeg();
cmd.input('input.mp4');
cmd.output(fs.createWriteStream('output.mp4'))
  .format('mp4');
const process = await cmd.spawn();
await process.complete();

If we look at the stack trace in FFmpeg's stderr we'll see:

[mp4 @ 0xffffffffffff] muxer does not support non seekable output

Some formats, specifically images require you to explicitly specify a special demuxer. For example, the following won't work:

const cmd = ffmpeg();
cmd.input(fs.createReadStream('image.gif'));
cmd.output('output.mp4');
const process = await cmd.spawn();
await process.complete();

But it can be easily fixed

const cmd = ffmpeg();
cmd.input(fs.createReadStream('image.gif'))
  .format('gif_pipe'); // <- specify gif_pipe as demuxer
cmd.output('output.mp4');
const process = await cmd.spawn();
await process.complete();
Clone this wiki locally