m4a audio file convert to flac c# [closed]

白昼怎懂夜的黑 提交于 2019-12-13 03:41:26

问题


I have been searching for the C# library or code sample which could help me to do the conversion of m4a audio file to flac, but more importantly with sample rate (of 16000), mono channel and bit resolution of either 16 or 24.

Right now, I have found library solutions like NAudio, MediaToolKit and SOXSharp. But I cannot get enough information how to use them accordingly.

I needed those converted audio files for Google Cloud speech to text API inputs.

I have found this great website where I can convert files manually and they are working great with API.

Is there any C# library which can help to convert .M4A audio file to .FLAC?


回答1:


I was able to solve this issue with library FFMpeg.Net and FFMpeg.

Install on windows guide here.

and then in code

var inputFile = new MediaFile (@"C:\file.m4a");
var outputFile = new MediaFile (@"C:\file.flac");

var ffmpeg = new Engine("C:\\ffmpeg\\ffmpeg.exe");
await ffmpeg.ConvertAsync(inputFile, outputFile);

Beware there might be file write permission denied error when writing to c:// and windows environment variable.



来源:https://stackoverflow.com/questions/56573987/m4a-audio-file-convert-to-flac-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!