I am trying to concatenate files with named pipes in node js using child process and ffmpeg. I tried to give the text input in this format:
file 'pipe:3'
file 'pipe:4'
But this doesn't work as 'pipe' is not in the whitelist Then I added 'pipe' to the protocol-whitelist. This doesn't help either, and the console outputs a bunch of gibberish. What should I do now? This is my current spawn command.
const command = spawn('ffmpeg', ['-f', 'concat', '-safe', '0', '-protocol_whitelist', 'file,pipe', '-i', 'data/' + mergedVideoName + '.txt', '-c', 'copy', '-f', 'ismv', 'pipe:1'], {
stdio: pipes
})
Here, pipes are just the array with the required number of 'pipe' strings. I wanted to pass some streams via pipe method to the input directly instead of using the file system,.
Edit: I tried this again and now the stderr output is not gibberish, but I still can't get it to work. Here is the code for the file: https://pastebin.com/1GgCWGWk
I am able to get the first video as output, but not the next videos. As for the log from stderr, I mainly get this as the error:
[ismv @ 0000021c2ce14840] Non-monotonous DTS in output stream 0:0; previous: 273834031, current: 159533333; changing to 273834032. This may result in incorrect timestamps in the output file.
I also get this error:
[ismv @ 0000021c2ce14840] Track 0 starts with a nonzero dts 333333, while the moov already has been written. Set the delay_moov flag to handle this case.
And this error right at the end:
data: [concat @ 000001b4bebf5c00] Impossible to open 'pipe:5'
data/4ed57360-d5f8-11ec-b35f-7b4d7aa196cd.mp4.txt: Invalid data found when processing input
How do I solve these problems?