I'm trying to create a desktop live-streaming app in C#. The program must run under Windows and stream image from user's desktop to rtmp. There must also be options of framerate, video size, quality and codec (h263 and h264). I think FFmpeg is the best choise for this (if it is not so, please write a comment). I've managed to do everything I mentioned above with ffmpeg.exe using console. So I wish to know, can I include FFmpeg library into C# project (as a .lib or .dll) to use it instead of .exe, saving suitable functionality for my task? I'll be very grateful for any examples.
P.S. Here are some examples of commands I use:
ffmpeg -f dshow -i video=UScreenCapture -vcodec h264 -pix_fmt yuv420p -s 320x240 -f flv rtmp://[my adr]/desc
ffmpeg -f dshow -i video=UScreenCapture -vcodec h264 -r 15 -t 0:1:00 -q 12 -pix_fmt yuv420p -s 320x240 -f flv rtmp://[my adr]/desc
This is my sample, hope this help
You can use .exe file like this:
ffmpeg.StartInfo.UseShellExecute = false;
ffmpeg.StartInfo.RedirectStandardOutput = true;
ffmpeg.StartInfo.FileName = Server.MapPath("~/Video_Clips/ffmpeg.exe");
ffmpeg.StartInfo.Arguments = String.Format(@"-i ""{0}"" -threads 8 -f webm -aspect 16:9 -vcodec libvpx -deinterlace -g 120 -level 216 -profile 0 -qmax 42 -qmin 10 -rc_buf_aggressivity 0.95 -vb 2M -acodec libvorbis -aq 90 -ac 2 ""{1}""",
Server.MapPath("~/Video_Clips/" + sNameWithoutExtension + ".wmv"),
Server.MapPath("~/Video_Clips/" + sNameWithoutExtension + ".webm"));
ffmpeg.Start();
ffmpeg.WaitForExit();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With