私は現在、Expression Encoder SDK を試していますが、ライブ ストリーミングに関しては非常に使いにくいと感じています。ウェブカメラからビデオ ストリームをキャプチャし、プログラムでエンコードしてから、スクリプト コマンドを挿入しながら、コンピューターからライブ ストリームとして公開しようとしています。SDK を調べましたが、ライブ ストリームや Web カメラに関するものは見つかりません。いくつかのコード例では、クラスを使用してエンコードする方法について言及していますJob
が、私が見つけたのはファイルをローカルでエンコードすることだけです。
7375 次
1 に答える
2
まだ試していませんが、ストリーミングをサポートするはずの Microsoft.Expression.Encoder.Live.LiveJob というクラスがあります。サンプルを試してみたところ、ハードディスクからファイルがストリーミングされました。ビデオストリームのエンコードもサポートする必要があると思います。サンプル コードは次のとおりです (Encoder 3.0 の場合)。
using (LiveJob job = new LiveJob())
{
// Create a new file source from the file name we were passed in
LiveFileSource fileSource = job.AddFileSource(fileToEncode);
// Set this source to Loop when finished
fileSource.PlaybackMode = FileSourcePlaybackMode.Loop;
// Make this source the active one
job.ActivateSource(fileSource);
// Create a new windows media broadcast output format so we
// can broadcast this encoding on the current machine.
// We are going to use the default audio and video profiles
// that are created on this output format.
WindowsMediaBroadcastOutputFormat outputFormat = new WindowsMediaBroadcastOutputFormat();
// Let's broadcast on the local machine on port 8080
outputFormat.BroadcastPort = 8080;
// Set the output format on the job
job.OutputFormat = outputFormat;
// Start encoding
Console.Out.Write("Press 'x' to stop encoding...");
job.StartEncoding();
// Let's listen for a keypress to know when to stop encoding
while (Console.ReadKey(true).Key != ConsoleKey.X)
{
// We are waiting for the 'x' key
}
// Stop our encoding
Console.Out.WriteLine("Encoding stopped.");
job.StopEncoding();
}
于 2009-11-17T07:56:21.553 に答える