3

I am currently using ffmpeg-fluent to merge video files. (https://github.com/fluent-ffmpeg/node-fluent-ffmpeg)

Unfortunately, my loop in which I put files to merge fail at thousandth file with below exception :

Error ENAMETOOLONG in /nodes_modules/fluent-ffmpeg.

My question is :

how can i bypass this error for writing command with a number of unlimited character?

Boris S.
  • 1,068
  • 1
  • 8
  • 18
  • That error comes from your operating system, not anywhere in node. There's not really anything you can do about it - the filename is longer than your OS or filesystem are able to handle. – Matt Rollins May 30 '16 at 15:22
  • Ok. so...this error append on windows. Which operating system handle it ? – Boris S. May 30 '16 at 15:28

1 Answers1

1

This is an old question and unfortunately there's no code to point the problem for sure. But getting ENAMETOOLONG from ffmpeg on Windows usually means the command is really too long. And merging thousands of files makes this seem quite natural.

It still happens now in 2020. But one can work this around. We need to put the source filenames (for merger) into a text file and provide this text file as an input to ffmpeg.

A raw ffmpeg call would look like:

ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.wav

with mylist.txt being like:

file '/path/to/file1.wav'
file '/path/to/file2.wav'
file '/path/to/file3.wav'

With fluent-ffmpeg it's not intuitive but still feasible:

const cmd = ffmpeg();
cmd.input('mylist.txt')
   .inputOption(['-f concat', '-safe 0'])
   .output('out.wav')
   .run();

Note: Be careful with absolute paths of the list file and source files inside the list on Windows. Most ffmpeg versions would add the directory of the list to the source file resulting in similar corrupted path:

c:/ffmpeg/lists/c:/audiofiles/file1.wav

But you still can solve this if you go with url-formatted source files:

file 'file:c:/audiofiles/file1.wav'
file 'file:c:/audiofiles/file2.wav'
file 'file:c:/audiofiles/file3.wav'

I'm sure this will be helpful to someone searching for this ffmpeg error :-)

hypers
  • 1,045
  • 1
  • 12
  • 30