h2non / audioconcat

Tiny node.js module to concat multiple audio files using ffmpeg
45 stars 12 forks source link

Cancat same file to create loop #4

Open swampthang opened 7 years ago

swampthang commented 7 years ago

I've been working on an Electron project and am using fluent-ffmpeg. I need to be able to create an output file that is x number of copies of a loop file. I'm able to accomplish what I need in the Mac version but Windows is killing me. Searching for an alternative way to tap into ffmpeg to accomplish this in Windows.

I was hoping I could do something like this...

ffmpeg -i "concat:audio-1.mp3|audio-1.mp3" -acodec copy out.mp3

... and let it concat the input file on to itself. On the command line it results in the original file length so it's ignoring anything that refers back to itself. Is there a way using audioconcat to accomplish this?

What I'm currently doing using fluent-ffmpeg is:

// variables declared earlier in the script
proc.videoFilter('-lavfi');
if(process.platform == 'win32') {
  proc.videoFilter(`amovie=${audioFile}:aloop=${data.numLoops}`);
} else {
  proc.addOption('-filter_complex', `amovie=${data.filepath}:loop=${data.numLoops}`);
}

Like I said, it works on Mac but not in Windows. It doesn't throw an error, just copies the input file to the output file. Using...

proc.addOption('-filter_complex', `amovie=${data.filepath}:loop=${data.numLoops}`);

...causes an error in Windows.

h2non commented 7 years ago

I can only say one thing: stop using Windows. Staying away from crappy operative systems is a highly recommended strategy :D

Ok, not seriously, I don't know why you are expermenting that. Theorically, ffmpeg's CLI interfaces are cross-platform compatible. I didn't run Windows at all in the last ~5 years, so I can't help you there.