1

C# ウィンドウに FFMPEG ビデオ ストリームを渡すことは可能ですか? 新しいウィンドウで新しいプロセスとして開くようになりました。単にそれを自分のSessionWindowに渡したいだけです。この時点で、次のように ffplay を実行します。

public void ExecuteCommandSync(String command, String args)
{
    try
    {
        System.Diagnostics.ProcessStartInfo procStartInfo =
         new System.Diagnostics.ProcessStartInfo("\"" + command + "\"", args);

        procStartInfo.RedirectStandardOutput = true;
        procStartInfo.UseShellExecute = false;

        procStartInfo.CreateNoWindow = true;

        System.Diagnostics.Process proc = new System.Diagnostics.Process();
        proc.StartInfo = procStartInfo;
        proc.Start();

        string result = proc.StandardOutput.ReadToEnd();

        Debug.WriteLine(result);
    }
    catch (Exception objException)
    {

    }
}

private void button2_Click(object sender, EventArgs e)
{
    String runPlay = @"C:\FFMPEG\bin\ffplay.exe";
    String Random = "udp://127.0.0.1:1234";

    this.ExecuteCommandSync(runPlay, Random);
}

PS。このアプリをリモート デスクトップのように見せて動作させたいので、Windows Media Player を使用したくありません。

4

1 に答える 1

0

答えが見つかったようです。

 Process ProcFFplay = new Process();
        ProcFFplay.StartInfo.FileName = @"C:\FFMPEG\bin\ffplay.exe";
        ProcFFplay.StartInfo.Arguments = @"-probesize 32 udp://192.168.88.228:12340";
        ProcFFplay.StartInfo.CreateNoWindow = true;
        ProcFFplay.StartInfo.RedirectStandardOutput = true;
        ProcFFplay.StartInfo.UseShellExecute = false;
        ProcFFplay.EnableRaisingEvents = true;
        ProcFFplay.OutputDataReceived += (o, k) => Debug.WriteLine(k.Data ?? "NULL", "ffplay");
        ProcFFplay.ErrorDataReceived += (o, k) => Debug.WriteLine(k.Data ?? "NULL", "ffplay");
        ProcFFplay.Exited += (o, k) => Debug.WriteLine("Exited", "ffplay");
        ProcFFplay.Start();
        Thread.Sleep(4500);//this is time which you need to wait to get first frames approximately
        SetParent(ProcFFplay.MainWindowHandle, this.panel1.Handle);
        MoveWindow(ProcFFplay.MainWindowHandle, -5, -30, 1200, 800, true); //these parameteres may look weird but you hide top "stripe" using them.

楽しみ。

于 2016-06-04T18:22:44.170 に答える