Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concat question. #496

Closed
maxfridbe opened this issue Feb 5, 2016 · 4 comments

Comments

@maxfridbe
Copy link

commented Feb 5, 2016

How can i achieve a command like this:

ffmpeg -f concat -i mylist.txt -c copy output.mp4

As Described here: https://trac.ffmpeg.org/wiki/Concatenate

I tried several of your examples but they resulted in different commands.

@njoyard

This comment has been minimized.

Copy link
Member

commented Feb 21, 2016

Have you read the documentation ? Which part of your command do you fail to reproduce ?

@youran

This comment has been minimized.

Copy link

commented Mar 26, 2016

mergeToFile() can't do it because it is using a complex filtergraph.
Filtering and streamcopy cannot be used together.

The execution of op's command would be very fast, while mergeToFile() is slow, as it involves re-encoding.

Is it a way to produce op's command from mergeToFile() or other API?

@njoyard

This comment has been minimized.

Copy link
Member

commented Mar 29, 2016

Maybe ffmpeg('mylist.txt').inputFormat('concat').writeToFile('output.mp4') should work ?

@youran

This comment has been minimized.

Copy link

commented Mar 29, 2016

I've found a working solution:

var fs = require('fs');
var fileList = ['part1.mp4', 'part2.mp4']; // files to merge
var listFileName = 'list.txt', fileNames = '';

// ffmpeg -f concat -i mylist.txt -c copy output
fileList.forEach(function(fileName, index){
fileNames = fileNames + 'file ' + ''' + fileName + ''\n';
});

fs.writeFileSync(listFileName, fileNames);

var merge = ffmpeg();
merge.input(listFileName)
.inputOptions(['-f concat', '-safe 0'])
.outputOptions('-c copy')
.save('/path/to/merged/file');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.