C# 如何读取.mp4视频,然后将其放入NamedPipeServerStream?

C# 如何读取.mp4视频,然后将其放入NamedPipeServerStream?,c#,ffmpeg,pipe,named-pipes,C#,Ffmpeg,Pipe,Named Pipes,我该如何使用StreamReader读取.mp4,然后将其放入管道中? 我需要读取数据并将其发送到管道。我读了.mpg4文件。然后通过ffmpeg进行处理。我是否正在尝试将文件正确发送到管道 public void getVideoFramesFromLocalPath(string fileName, string outputFileName, int period) { Thread th1 = new Thread(new ParameterizedThreadS

我该如何使用StreamReader读取.mp4,然后将其放入管道中? 我需要读取数据并将其发送到管道。我读了.mpg4文件。然后通过ffmpeg进行处理。我是否正在尝试将文件正确发送到管道

public void getVideoFramesFromLocalPath(string fileName, string outputFileName, int period)
    {
        Thread th1 = new Thread(new ParameterizedThreadStart(PipeLine));
        th1.Start(fileName);            

        int bitrate = 5000;
        int fps = 10;

        string strTakeFrame = $"-f image2pipe -i pipe:videoPipe -qscale:v 4 -vf fps=1/{period} {outputFileName}_%04d.jpg";       

        ffProcessStart(strTakeFrame);
    }

    private async void PipeLine(object fileName)
    {
        StreamReader SR = new StreamReader((string)fileName);
        NamedPipeServerStream pipeServer = new NamedPipeServerStream("videoPipe", PipeDirection.Out);
        pipeServer.WaitForConnection();
        StreamWriter SW = new StreamWriter(pipeServer);
        SW.Write(SR.ReadToEnd());
        SW.Flush();
    }
    static void ffProcessStart(string commandLine)
    {
        ProcessStartInfo startInfo = new ProcessStartInfo();            

        startInfo.CreateNoWindow = false;                                

        startInfo.UseShellExecute = false;                              

        startInfo.FileName = @"ffmpeg.exe";                             

        startInfo.WindowStyle = ProcessWindowStyle.Hidden;              

        startInfo.Arguments = commandLine;                              

        try
        {
            using (Process exeProcess = Process.Start(startInfo))       
            {
                exeProcess.WaitForExit();                              
            }
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
        }
    }