rosenbjerg/FFMpegCore

video conversion performs very slowly

Opened this issue · 1 comments

system:windows 10
ffmpegcore-version:5.1.0
vs2022
I use CMD to execute:
ffmpeg.exe -i D:/VideoFile/a.mp4 -c:v copy -c:a aac D:/VideoFile/b.mp4
execution time:0.8s

use FFmpegCore

 GlobalFFOptions.Configure(new FFOptions { BinaryFolder = "./bin", TemporaryFilesFolder = "/tmp" });

 string inputPath = $"D:\\VideoFile\\a.mp4";
 string outputPath = $"D:\\VideoFile\\" + NewId.Next().ToString("D").ToUpperInvariant() + ".mp4";

 var result = FFMpegArguments
.FromFileInput(inputPath)
.OutputToFile(outputPath
, true, options => options
    .WithVideoCodec(" copy ")
    .WithAudioCodec("aac")
    .WithFastStart()
 )
.ProcessSynchronously();

execution time:23s
What's the problem?
Thank you for your answer.

Your args translate to -i "D:\VideoFile\a.mp4" -c:v copy -c:a aac -movflags faststart "D:\VideoFile\b.mp4" -y

Have you tried to remove the WithFastStart argument ? also, you can use directly the copy Channel argument option:

            var arg1 = FFMpegArguments
                .FromFileInput(inputPath)
                .OutputToFile(outputPath, true, options => options
                    .CopyChannel(Channel.Video)
                    .WithAudioCodec("aac"));