Click here to Skip to main content
15,887,966 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi dear,
I want to create a video during 15 seconds using one picture in C#.
I try a lot of way but I couldn't , if anyone has solution pleas help me.

this is my code :

What I have tried:

using (Process p = new Process())
{
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.CreateNoWindow = true;
    p.StartInfo.RedirectStandardOutput = true;
    p.StartInfo.FileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "\\ffmpeg.exe");
    p.StartInfo.Arguments = "-loop 1 -i D:\\Temp\\temp.png -c:v libx264 -t 15 -pix_fmt yuv420p -vf scale=720:480 D:\\Temp\\1.avi";
    p.Start();
    p.WaitForExit();
}

Also I used this but it didn't work too :
System.Diagnostics.Process.Start("CMD.exe", "/K D:\\Temp\\ffmpeg -loop 1 -i D:\\Temp\\temp.png -c:v libx264 -t 15 -pix_fmt yuv420p -vf scale=720:480 D:\\Temp\\1.mp4");  
Posted
Updated 17-Feb-18 2:50am

1 solution

A lot of people seem to struggle with this, this one seems to have an answer: c# - Image sequence to video stream? - Stack Overflow[^]
 
Share this answer
 
Comments
Member 13682761 18-Feb-18 13:55pm    
there is no solution using ffmpeg directly in c#?
RickZeeland 18-Feb-18 13:57pm    
I googled around a bit, but only saw people complaining that it would not work :(
Member 10922202 12-Nov-19 18:04pm    
It really DOES work! I managed to get it to work wit c# in WPF and UWP (WPF RuntimeComponent).

Some inputs I used:
https://stackoverflow.com/questions/1707516/c-sharp-and-ffmpeg-preferably-without-shell-commands
https://stackoverflow.com/questions/15758114/using-ffmpeg-in-c-sharp-project

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