Node-fluent-ffmpeg: How to do "-f concat -safe 0 -i list.txt"?

Created on 20 Aug 2016  Â·  4Comments  Â·  Source: fluent-ffmpeg/node-fluent-ffmpeg

I cannot find a way to do this, if I use addOption('-f concat -safe 0 -i /tmp/webm/list.txt') I get
Error: ffmpeg exited with code 1: Unrecognized option 'f concat -safe 0 -i /tmp/webm/list.txt'.

But it the command line it does (on start) is ffmpeg -y -f concat -safe 0 -i /tmp/webm/list.txt -c copy /tmp/a.webm which copy-pasted in a terminal works…

Note I also use addOutputOption('-c copy').

How can I add that filter with those parameters?

Most helpful comment

Hey @Laurian, I had the same problem today, here is my example solution:

const createVideo = basePath =>
  new Promise((resolve, reject) =>
    ffmpeg(`${basePath}/files.txt`)
      .inputOption(['-f concat'])
      .videoCodec('libx264')
      .outputOptions(['-c copy'])
      .outputFormat('mp4')
      .on('done', resolve)
      .on('error', reject)
      .save(`${basePath}/output.mp4`)
  );

All 4 comments

You cannot pass several command line arguments in one string. Ffmpeg will see it as 1 argument and not recognize it. And please, _please_, if you want to use this lib, use its API. -f concat and -i something have nothing to do in addOption. If you prefer to pass an arbitrary command line, please run ffmpeg directly with nodejs child_process module.

Closing because no feedback was given, but feel free to reopen if necessary!

Hey @Laurian, I had the same problem today, here is my example solution:

const createVideo = basePath =>
  new Promise((resolve, reject) =>
    ffmpeg(`${basePath}/files.txt`)
      .inputOption(['-f concat'])
      .videoCodec('libx264')
      .outputOptions(['-c copy'])
      .outputFormat('mp4')
      .on('done', resolve)
      .on('error', reject)
      .save(`${basePath}/output.mp4`)
  );

so close to what i need. currently running
ffmpeg -y -r 1 -f concat -safe 0 -i 0401.txt -c:v libx264 -vf "fps=24,format=yuv420p" 0401.mp4

0401.txt is a list of files in the following syntax
file '/path/image.jpg'\r\n

Was this page helpful?
0 / 5 - 0 ratings