简体   繁体   中英

How to change path of output file in nodejs using an NPM package audioconcat

I wan to change the path of audiofile which i am getting in following program as output. here var songs are three audio file which i merged in one file named as all.mp3. I want to change the output file path and want to insert this path in database also. here is the code:

var audioconcat = require('audioconcat')

var songs = [
  'a(1).mp3',
  'a(2).mp3',
  'a(3).mp3'
]

audioconcat(songs)

  .concat('all.mp3') 
  .on('start', function (command) {
    console.log('ffmpeg process started:', command)
  })
  .on('error', function (err, stdout, stderr) {
    console.error('Error:', err)
    console.error('ffmpeg stderr:', stderr)
  })
  .on('end', function (output) {
    console.error('Audio created in:', output)
  })

I found the solution.

here I am fetching audio files to array

  var songs = [
      '{C:/Projects/audio/public/b(2).mp3}',
      '{C:/Projects/audio/public/b(3).mp3}',
      '{C:/Projects/audio/public/b(4).mp3}'

    ]
     console.log("songs checked")


    //here i am changing path
     var abc = 'C:/Projects/audio/public/sentence after merge.MP3';
    audioconcat(songs)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM