watson-developer-cloud / node-red-node-watson

A collection of nodes for the IBM Watson services
Apache License 2.0
82 stars 86 forks source link

Convert mono to stereo in ffmpeg conversion node-red-contrib-media-utils #219

Closed johnwalicki closed 7 years ago

johnwalicki commented 7 years ago

When calling Watson TTS, the wav file output is returned as a mono single channel. The Raspberry Pi does not like to play mono files and really wants stereo channels.

Using ffmpeg, it is easy to convert a mono to a stereo file - https://trac.ffmpeg.org/wiki/AudioChannelManipulation https://ffmpeg.org/ffmpeg-filters.html#Examples-6

Here is the conversion that I need to run to play a wav file from Watson TTS on a Raspberry Pi /usr/bin/ffmpeg -y -i /tmp/input-mono.wav -ar 48000 -ac 2 /tmp/output-stereo.wav

I built an Exec node to run that command. It works but is a hack. Would be great to have a proper ffmpeg conversion feature in the node-red-contrib-media-util Note too that -y allows you to replace any existing .wav file

chughts commented 7 years ago

@johnwalicki I have sent you a fix, please test.

chughts commented 7 years ago

Fixed in V 0.0.3 of node-red-contrib-media-utils

johnwalicki commented 7 years ago

My tests were successful. Thanks for the improvement to the ffmpeg conversion node.