How to convert '.opus' file to flac file format - node.js

I have an audio file with '.opus' format.
http://img.wbcsrv.com/2017/03/14/4915792368684-41222-919020044692-1489468385000.opus
I need to use it with google cloud speech API. But the google speech API only support some file encodings, specified in https://cloud.google.com/speech/docs/basics#audio-encodings . How can i use 'opus' file format with google cloud speech API?
Is there any way to convert '.opus' file into the specified(googles audio encoding documentation) format or any npm available for do this?

In Node you can use ffmpgeg in several ways, using:
https://www.npmjs.com/package/ffmpeg
https://www.npmjs.com/package/ffmpeg-node
https://www.npmjs.com/package/ffmpeg-static
https://www.npmjs.com/package/ffmpeg-wrap
few more at https://www.npmjs.com/search?q=ffmpeg
The ffmpeg supports Opus according to the docs:
https://www.ffmpeg.org/ffmpeg-codecs.html#opus
https://www.ffmpeg.org/ffmpeg-codecs.html#libopus
https://www.ffmpeg.org/ffmpeg-codecs.html#libopus-1
You may need to use libopus for that:
http://opus-codec.org/downloads/
The ffmpeg also supports encoding FLAC so it can also be used for that part:
https://www.ffmpeg.org/ffmpeg-codecs.html#flac-2
There is not a straightforward way to convert Opus to Flac using Node without any external dependencies but it should be possible using the modules and libraries above.

Related

Is there any way to transcribe a audio file(audio-only0000000000.m4s or audio-only.m3u8) using #google-cloud/speech

I have generated the audio file from a video file(.mp4) by using #google-cloud/video-transcoder
I have a video file in the gcp bucket, I transcode the video on the same bucket folder. The audio is generated audio-only.m3u8 and audio-only0000000000.m4s.
1> Is there any way to generate audio file other than this format using #google-cloud/video-transcoder ??
2> Is there any way to generate transcribe text from this audio format using #google-cloud/speech ??
I haven't get any solution to generate text from this format.
I want a solution to generate/transcribe text from any audio/video file format.
Also I want to step by step process for transcode and transcribe of the transcoded audio file. Or if any solution for transcode and transcribe at once.
Note: Using only gcp bucket and #google-cloud/video-transcoder and #google-cloud/speech and #google-cloud/storage

Convert SILK encoded data to wav file in python

I was surprised I couldn't find an answer to this from a search - maybe I'm using the wrong search terms.
I have what I suspect is a silk compressed datastream (see below) that I would like to turn into a audio file (something like wav ideally). I'm planning on doing this in python, however I have no idea how to do this - I don't get any reasonable searches for how to decompresses the data with silk - maybe there's no silk packages for python (?).
Silk data:
uz+ACgEAEAELgD4EQgEWAKV4mxnepfmhxKCQxAnKVNaHhKRXPIsmAH5RjXmJV0u+WTmrvgyCKxcraehjo/ZeKcFjksXQZEeOju4hLNv/MAB9KA7ww14Vc0ndYPB7dDXoXTexuxcW0Jg/diMgdH5ijWhe02Ch48KX86qJZYFyZV81AH76qCgh9AXliMdyWEgWTMbRD6xMX37WJALrXlSnxymIloSq2KGwXCcMXzQiSQIrcLVNfqdNJACCluFOIRKPmugUvsLZmnD04X0xhpAuNkwJECK4t51MBOWNWJlCAIDyZlJwWI45EPTjBB6yKyGOclu96qBV2MhFAh1d2J7WDZwe6YxOVu/BGkGcur9qTP85ZRfjANoiQxQrWvpoHFBFBy0AfX6k8XvbSwrk2nUAEP3P6kcmXORKUNKeu8HDnOUflQqtA5AkkTiun77fZrqnimIfWg==
First, validate your assumption that it is SILK.
If you open an encoded binary file, it should start with the header "#!SILK_V3". Your excerpt seems like some base64 encoding (maybe the raw binary?).
If you do get to the real silk data, you can decode it with the original Skype Silk SDK. There is probably no python port for this, but you can invoke external libs from python.
Once decoded, use ffmpeg/Audacity raw import/other to convert to WAV/mp3 and test the audio. Then in python, using the wave library or wavio api should work.

iOS - Convert Audio Format (opus to mp3)

Recently I started to develop application that work with .opus file (Audio Format).
I am working with external SDK that can processor a mp3/wav file, unfortunately my local file is a .opus file and I need to convert it to mp3/wav format in order to process the file.
I read and research a lot around the network to find a solution,
I found the FFmpegWrapper library that can convert two type of Audio Format but when I try to convert .opus to .mp3/ , I get this error: opus codec not supported in WAVE format
I do not know what can be done, I'll be happy to help.
Any information about how to convert .Opus format to any other format will be appreciated.
Thanks
Have you tried using this pod: https://github.com/chrisballinger/Opus-iOS
You can use it to convert your Opus-encoded file to wav, then feed it into your SDK.

FFmpeg library: Muxing audio from external file

I have successfully changed the muxing.c sample to use video frames that I generate on runtime.
I am trying now to replace the get_audio_frame function with a function that decodes an existing audio file, and writes its samples instead of the synthesized audio-samples in the example code.
I've tried using the "audio decoding" example to decode the audio file, but the not sure how / when to write the samples decoded.
I suggest to check the source of my Karaoke Lyrics Editor which is doing exactly what you need based on ffmpeg. See ffmpegvideoencoder.cpp, see createFile and encodeImage functions.

how to decode amr files using c#.net

I need to decode amr format to pcm format, which is later converted to mp3 using c#.net. But I am hardly finding any library to do so. It seems with NAudio it is not possible. Is there any c# based open source library which can be used to decode this format files?. Presently I am working on windows server 2012(64 bit).
NAudio Code:
public void Decode()
{
.....
var result= new MediaFoundationReader("..\\sample.amr");
// later converted to mp3 here
}
It looks you two guys are doing the same thing: How to convert amr files to mp3 using C#
You typically need to have a [third party] AMR decoder installed and integrated into Windows API (ACM, DirectShow, Media Foundation). Then you will use your favorite library around this API, such as NAudio.
Example of AMR decoder: MONOGRAM AMR Pack.
You're unlikely to find a C# decoder for AMR files. I'd recommend just finding a command-line utility that you can call to convert to PCM. For example, it looks like sox can be used to decode AMR.

Resources