[FFmpeg-trac] #11333(undetermined:new): Using c# code to call version 7.1 ffmpeg, the video will stop after converting only a small portion

FFmpeg trac at avcodec.org
Wed Dec 4 13:39:59 EET 2024


#11333: Using c# code to call version 7.1 ffmpeg, the video will stop after
converting only a small portion
-------------------------------------+-------------------------------------
             Reporter:  gegegegege   |                     Type:  defect
               Status:  new          |                 Priority:  critical
            Component:               |                  Version:  git-
  undetermined                       |  master
             Keywords:  c#           |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:
 How to reproduce:
 {{{
 ffmpeg version 7.1
 built on essentials
 }}}


 {{{
 internal class Program
     {
         public static void Main(string[] args)
         {
             // 定义FFmpeg可执行文件的路径,如果FFmpeg已添加到系统路径,则
 可以直接使用"ffmpeg"
             string ffmpegPath =
 @"F:\ffmpeg-7.1-essentials_build\bin\ffmpeg.exe";

             // 定义输入和输出文件路径
             string inputFile = "D:\\gege\\_平面空间视频\\_苹果立体视频\\新
 建文件夹\\IMG_1940_1.MOV";
             string outputFile = "D:\\gege\\_平面空间视频\\_苹果立体视频\\
 新建文件夹\\IMG_1940_1UD.mp4";

             // 定义FFmpeg命令参数
             string arguments = $"-i \"{inputFile}\" -filter_complex \"[0:
 v:view:0][0:v:view:1]hstack\" -c:v hevc -tag:v hvc1
 \"{outputFile}\"";

             // 创建一个ProcessStartInfo对象来配置FFmpeg进程
             ProcessStartInfo startInfo = new ProcessStartInfo
             {
                 FileName = ffmpegPath,
                 Arguments = arguments,
                 RedirectStandardOutput = true,
                 RedirectStandardError = true,
                 UseShellExecute = false,
                 CreateNoWindow = false
                 //WindowStyle = ProcessWindowStyle.Maximized,
             };


             Process process = Process.Start(startInfo);



             //process.WaitForExit();



             //
             //
 Process.Start(@"F:\ffmpeg-7.1-essentials_build\bin\ffmpeg.exe",
             //     "-i \"D:\\gege\\_平面空间视频\\_苹果立体视频\\新建文件
 夹\\IMG_1940_1.MOV\" -filter_complex \"[0:v:view:0][0:v:view:
 1]hstack\" -c:v hevc -tag:v hvc1 \"D:\\gege\\_平面空间视频\\_苹果立体视频
 \\新建文件夹\\IMG_1940_1UD.mp4\"");
             //



             // 启动FFmpeg进程
             /*using (Process process = Process.Start(startInfo))
             {
                 // 读取标准输出和错误流(可选)
                 string output = process.StandardOutput.ReadToEnd();
                 string errors = process.StandardError.ReadToEnd();

                 // 等待FFmpeg进程结束
                 process.WaitForExit();

                 // 检查是否有错误发生(可选)
                 if (!string.IsNullOrEmpty(errors))
                 {
                     Console.WriteLine("Errors occurred during
 conversion:");
                     Console.WriteLine(errors);
                 }
                 else
                 {
                     Console.WriteLine("Conversion completed
 successfully.");
                 }
             }*/
         }
     }
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/11333>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list