Skip to content

Instantly share code, notes, and snippets.

@teezzan
Created August 20, 2020 09:42
Show Gist options
  • Save teezzan/ed6b886371be760840992d08afced754 to your computer and use it in GitHub Desktop.
Save teezzan/ed6b886371be760840992d08afced754 to your computer and use it in GitHub Desktop.
axios({
method: "get",
url: rec_Url,
responseType: "stream"
}).then(function (response) {
response.data.pipe(fs.createWriteStream("./my.mp3"));
}).then(() => {
// From a local path...
mm.parseFile('./my.mp3')
.then(metadata => {
console.log(metadata);
})
// make sure you set the correct path to your video file
var proc = ffmpeg('./images/image.png')
// loop for 5 seconds
// .loop()
.input(rec_Url)
// setup event handlers
.on('end', function () {
console.log('file has been converted succesfully');
})
.on('error', function (err) {
console.log('an error happened: ' + err.message);
})
// save to file
.save('./newpost.mp4');
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment