Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
What is the fastest why of create a thumbnail from a video by FFmpeg or anything else in WPF c#?
look at the code in what I have tried section
it takes about 3 seconds
How can I reduce it

What I have tried:

C#
 string Arguments = 
@"-ss " + (int)starttime + 
"  -i \"" + InputFileUrl+"\"" +
@" -y -vf scale=" + Width + ":" + Height +
" \"" + OutputFileUrl + "\"";
             
           
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = @"ffmpeg.exe";
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
psi.Arguments = Arguments;
using (Process prc_createImage=new Process())
{
prc_createImage.StartInfo = psi;
prc_createImage.Start();
prc_createImage.PriorityClass = ProcessPriorityClass.High;
prc_createImage.WaitForExit(5000);
}
Posted
Updated 17-Jul-21 2:02am
v2
Comments
Richard MacCutchan 17-Jul-21 9:33am    
The time is probably down to the ffmpeg processing; and that is easy to test.
4L4K1 17-Jul-21 10:10am    
yeah it is
I test it by stopwatch
I need a faster way
ty
Richard MacCutchan 17-Jul-21 10:24am    
Faster way for what? If ffmpeg takes 3 seconds for the conversion, then thart is how much time it takes.
[no name] 17-Jul-21 11:46am    
Your timing includes startup / teardown time. You need a server / batch capability.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900