I am using NAudio MFT to convert different audio formats to MP3.
Now i want to convert amr file to MP3 using Naudio MFT. But, when i given amr file as input to MFT, it has thrown following exception "Exception from HRESULT: 0xC00D36C4". Is there any way to achieve this?
My C# code:
public byte[] ConvertAMRToMP3( )
{
var data = new MediaFoundationReader("..\\amr\\test.amr");
MediaFoundationEncoder.EncodeToMP3(data, "..\\test.mp3", 128000);
......
}
I am working on windows server 2012 64-bit platform.
Thanks in advance.
0xC00D36C4 is MF_E_UNSUPPORTED_BYTESTREAM_TYPE "The byte stream type of the given URL is unsupported."
There is no support for AMR in Media Foundation codecs.
Related
I've been using the Xamarin libVLCSharp player for a while on iOS and Android and it works well. I've added a transcoding feature, but for some reason my libVLCSharp code works fine to transcode on Android (change codec, bitrate, fps), but the same transcode media options on iOS (iPhone 12 pro, iOS 14.4.2) produce no changes in the output video file compared to the input video file. I have attached the sample video file which I am attempting to transcode.
Here is my C# code (which contains the transcode media options that works on Android, but not iOS):
Core.Initialize();
_vlc = new LibVLC();
_player = new LibVLCSharp.Shared.MediaPlayer(_vlc);
_media = new Media(_vlc, _source, FromType.FromPath);
_media.AddOption ($":sout=#transcode{{vcodec=h264,vb=700000,acodec=aac,ab=96,channels=2,samplerate=44100,scodec=none}}:std{{access=file,mux=ts,dst={destination}}}");
var result = _player.Play(_media);
Any help or pointers on why this transcoding command is not producing any change in the output media file compared to the original would be greatly appreciated!
iOS Logfile
https://drive.google.com/file/d/1C0UGzE7hqCJYozTvubyK1BKWcZvG18VY/view
Sample file I'm using to test transcoding:
https://drive.google.com/file/d/1MvJKJnu2ii6XMANuWRkHLqmu78e9x03q/view
Try with
$":sout=#transcode{venc={module=avcodec{codec=h264_videotoolbox}, vcodec=h264},venc={module=vpx{quality-mode=2},vcodec=VP80},samplerate=44100,soverlay}:file{dst={destination},mux=ts}"
Feel free to remove unnecessary options, but from my findings this exact string should work.
Im trying to receive a conversation streaming from Twilio in 8kHz mulaw and I want to convert it to 16kHz PCM for some processing ( that doesnt support 8kHz mulaw format), I tried this method but without success :
- convert the string payload to base64 buffer.
- convert the buffer to Uint8Array with this package: buffer-to-uint8array.
- convert the Uint8Array to Int16Array with this pacakge: alawmulaw.
- then use wav library to write the results.
I am still unable to get a valid audio file following this process, Can someone tell me what i am doing wrong ? or guide me to achieve this ?
I've had good luck using the WaveFile lib (https://www.npmjs.com/package/wavefile)
const wav = new WaveFile();
wav.fromScratch(1, 8000, '8m', Buffer.from(payload, "base64"));
wav.fromMuLaw();
// You can resample.
wav.toSampleRate(16000);
// You can write this straight to a file (will have the headers)
const results = wav.toBuffer();
// Or you can access the samples without the WAV header
const samples = wav.data.samples;
Hope that helps!
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.
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.
I am trying to convert a PCM Wav file recorded with the WasapiLoopbackCapture class to an AAC file. The Wav file is 44100, 32bit, 4 channels.
using (var reader = new MediaFoundationReader("recordedfile.wav"))
{
MediaFoundationEncoder.EncodeToAac(reader, "encodedfile.mp4");
}
However, i get a COMException from the MediaFoundationReader:
Exception from HRESULT: 0xC00D5212
What am i doing wrong here and what would be the proper way to convert from PCM WAV to AAC?
Thanks
This probably means you haven't got an AAC encoder (or something is up with the WaveFormat of your recorded WAV file). What version of Windows are you using?
I battled this problem for a few days before ultimately discovering that you need to install The Microsoft Media Foundation AAC Decoder.
https://superuser.com/questions/819227/how-to-fix-missing-media-foundation-microsoft-aac-audio-decoder-transform-mft-wi
https://www.microsoft.com/en-us/download/confirmation.aspx?id=13283