あなたのwebroleにはLocal Storage Resourceを使用し、AlobファイルをBlobストレージからダウンロードしてMP3に変換することをお勧めします。その後、ブロブストレージにアップロードし直します。
サイドノートでは、Path.GetTempFileName()を使用してAAC/MP3ファイルの一時ファイル名を取得することもできますが、これを行うことはお勧めしません。
実行中のffmpegに関しては、以前作成したAzureVideoConvのコードを参照することをお勧めします。そこにはたくさんの便利なコードがあります。
:ここ
は、実際のffmpegの呼び出し(外部EXEファイルと私の紺碧のパッケージを膨満感を避けるために、必要な時に簡単にffmpeg.exeを更新するために、私はブロブストレージからexeファイルをダウンロードすることに注意してください)のサンプルです
internal void ConvertFile(string inputFileName, Guid taskID)
{
string tmpName = string.Format(
"{0}\\{1}.flv",
Path.GetTempPath(), inputFileName.Substring(inputFileName.LastIndexOf("\\")+1));
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = this._processorExecutable;
psi.Arguments = string.Format(@"-i ""{0}"" -y ""{1}""", inputFileName, tmpName);
psi.CreateNoWindow = true;
psi.ErrorDialog = false;
psi.UseShellExecute = false;
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = false;
psi.RedirectStandardError = true;
try
{
// Start the process with the info we specified.
// Call WaitForExit and then the using statement will close.
using (Process exeProcess = Process.Start(psi))
{
exeProcess.PriorityClass = ProcessPriorityClass.High;
string outString = string.Empty;
// use ansynchronous reading for at least one of the streams
// to avoid deadlock
exeProcess.OutputDataReceived += (s, e) => {
outString += e.Data;
};
exeProcess.BeginOutputReadLine();
// now read the StandardError stream to the end
// this will cause our main thread to wait for the
// stream to close (which is when ffmpeg quits)
string errString = exeProcess.StandardError.ReadToEnd();
Trace.WriteLine(outString);
Trace.TraceError(errString);
byte[] fileBytes = File.ReadAllBytes(tmpName);
if (fileBytes.Length > 0)
{
this._sSystem.SaveOutputFile(
fileBytes,
tmpName.Substring(tmpName.LastIndexOf("\\")+1),
taskID
);
}
}
}
catch (Exception e)
{
Trace.TraceError(e.Message);
}
}
NOTEプロジェクトの中の最後のチェックは
私はこれを1時間前に読んでいます、あなたの素晴らしい仕事に感謝します!しかし、私はC#で上手くいかないので、私は自分の文脈でそれを使う方法を知らない。私は自分のWebロール(ワーカーロールではない)のローカルストレージリソースを設定してから、blobから.exeと.aacをダウンロードする方法を教えてください。どのようにそれを実行するには?どのように.mp3をアップロードする? – Skyler
私のコードを詳しく見てみてください:http://azurevideoconv.codeplex.com/SourceControl/changeset/view/5501これであまりにも多くの質問があり、それらのすべてが私のコードで回答されています:)あなたはCodePlexのプロジェクトサイトでの議論で追加の質問があります。 – astaykov
OK。 3つのバージョンがあります。どちらを使うべきですか? – Skyler