sfxmix 1.1.6 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/demo/demo1_add_add_mix.mp3 +0 -0
- package/index.js +2 -8
- package/package.json +1 -1
|
Binary file
|
package/index.js
CHANGED
|
@@ -134,27 +134,21 @@ class SfxMix {
|
|
|
134
134
|
|
|
135
135
|
concatenateAudioFiles(inputFiles, outputFile) {
|
|
136
136
|
return new Promise((resolve, reject) => {
|
|
137
|
-
// Use absolute paths for input files
|
|
138
|
-
const absoluteInputFiles = inputFiles.map(file => path.resolve(file));
|
|
137
|
+
// Use absolute paths for input files based on process.cwd()
|
|
138
|
+
const absoluteInputFiles = inputFiles.map(file => path.isAbsolute(file) ? file : path.resolve(process.cwd(), file));
|
|
139
139
|
const concatList = absoluteInputFiles.map(file => `file '${file}'`).join('\n');
|
|
140
140
|
const concatFile = path.join(this.TMP_DIR, `concat_${uuidv4()}.txt`);
|
|
141
141
|
|
|
142
142
|
try {
|
|
143
143
|
fs.writeFileSync(concatFile, concatList);
|
|
144
|
-
// console.log(`Concat file created at: ${concatFile}`);
|
|
145
|
-
// console.log(`Concat file contents:\n${concatList}`);
|
|
146
144
|
|
|
147
145
|
ffmpeg()
|
|
148
146
|
.input(concatFile)
|
|
149
147
|
.inputOptions(['-f', 'concat', '-safe', '0'])
|
|
150
148
|
.outputOptions(['-c', 'copy'])
|
|
151
149
|
.output(outputFile)
|
|
152
|
-
.on('start', (commandLine) => {
|
|
153
|
-
// console.log('Spawned FFmpeg with command: ' + commandLine);
|
|
154
|
-
})
|
|
155
150
|
.on('end', () => {
|
|
156
151
|
fs.unlinkSync(concatFile);
|
|
157
|
-
// console.log(`Concatenation complete. Output file: ${outputFile}`);
|
|
158
152
|
resolve();
|
|
159
153
|
})
|
|
160
154
|
.on('error', (err) => {
|