I am trying to convert an audio stream from Amazon AWS Polly in Node.js using fluent-ffmpeg. The documentation says that I can convert a stream, which is what the output of Polly provides, but I am getting an "Invalid input" error.
polly.synthesizeSpeech(pollyParams, function (err, data) {
if (err) {
console.log(err)
} else {
console.log('Audio')
console.log(data)
ffmpeg().input(data.AudioStream).inputOptions(['-ac 2', '-codec:a libmp3lame', '-b:a 48k', '-ar 16000'])
}
Results in:
AudioStream: } 2017-07-27T14:07:09.335Z dd75614c-72d4-11e7-b7cd-5d4425c782fc Error: Invalid input at FfmpegCommand.proto.mergeAdd.proto.addInput.proto.input (/var/task/node_modules/fluent-ffmpeg/lib/options/inputs.js:34:15)
I know the output from Polly is a valid audio stream, because I am able to save it to an S3 bucket. I would prefer to convert the stream before saving to S3, rather than saving it, picking it up from S3, converting it, and then saving it again.
Thanks for your help!