Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg exited with code 1: Error configuring complex filters

I am using the fluent-ffmpeg node package to merge videos. I am following the documentation exactly but I get the following error : Error: ffmpeg exited with code 1: Error configuring complex filters. Here is the code :

ffmpeg('/videos/test/part1.mov')
  .input('/videos/test/part2.mov')
  .on('error', function(err) {
    console.log('An error occurred: ' + err.message);
  })
  .on('end', function() {
    console.log('Merging finished !');
  })
  .mergeToFile('videos/test/final.mp4', 'videos/test/tempDir');

and here is the error output (I logged the command generated by fluent-ffmpeg to the console):

C:\Program Files\ffmpeg\bin\ffmpeg.exe [ '-formats' ] { captureStdout: true }
C:\Program Files\ffmpeg\bin\ffmpeg.exe [ '-encoders' ] { captureStdout: true }
C:\Program Files\ffmpeg\bin\ffmpeg.exe [ '-i',
  '/videos/test/part1.mov',
  '-i','/videos/test/part2.mov',
  '-y',
  '-filter_complex',
  'concat=n=2:v=1:a=1',
  'videos/test/final.mp4' ] { niceness: 0 }
An error occurred: Error: ffmpeg exited with code 1: Error configuring complex filters.
Invalid argument

at ChildProcess.<anonymous> (C:\test\node_modules\fluent-ffmpeg\lib\processor.js:169:22)
at ChildProcess.emit (events.js:98:17)
at Process.ChildProcess._handle.onexit (child_process.js:809:12)

I'm able to run ffmpeg on my machine for other tasks and it works fine. I'm not sure what the '-filter_complex' flag is supposed to do. I am using fluent-ffmpeg version 2.0.1 and ffmpeg windows static build git-9d1fb9e (2015-12-17).

like image 458
rycornell Avatar asked Sep 26 '22 21:09

rycornell


1 Answers

The error occurred because the two videos had different frame sizes. Running ffmpeg manually provided more detailed output :

[Parsed_concat_0 @ 04fd2b40] Input link in1:v0 parameters (size 1920x1080, SAR 1:1) do not match the corresponding output link in0:v0 parameters (1280x720, SAR 1:1)
[Parsed_concat_0 @ 04fd2b40] Failed to configure output pad on Parsed_concat_0
Error configuring complex filters.
Invalid argument

This is also mentioned in the documentation : https://trac.ffmpeg.org/wiki/Concatenate#filter

like image 55
rycornell Avatar answered Oct 04 '22 18:10

rycornell