using ffmpeg gdigrab instead directshow filter

This commit is contained in:
Jaex 2014-05-09 11:45:45 +03:00
parent bb25962bd8
commit cf9ea2f99d

View file

@ -61,6 +61,9 @@ private void FFmpegCLIHelper_OutputDataReceived(object sender, DataReceivedEvent
public bool Record(Rectangle captureRectangle)
{
StringBuilder args = new StringBuilder();
/*
// https://github.com/rdp/screen-capture-recorder-to-video-windows-free configuration section
string dshowRegistryPath = "Software\\screen-capture-recorder";
RegistryHelpers.CreateRegistry(dshowRegistryPath, "start_x", captureRectangle.X);
@ -69,22 +72,25 @@ public bool Record(Rectangle captureRectangle)
RegistryHelpers.CreateRegistry(dshowRegistryPath, "capture_height", captureRectangle.Height);
RegistryHelpers.CreateRegistry(dshowRegistryPath, "default_max_fps", Options.FPS);
StringBuilder args = new StringBuilder();
// input FPS
args.AppendFormat("-r {0} ", Options.FPS);
args.Append("-f dshow -i ");
// dshow audio/video device: https://github.com/rdp/screen-capture-recorder-to-video-windows-free
//args.AppendFormat("audio=\"{0}\":", "virtual-audio-capturer");
args.AppendFormat("audio=\"{0}\":", "virtual-audio-capturer");
args.AppendFormat("video=\"{0}\" ", "screen-capture-recorder");
*/
// http://ffmpeg.org/ffmpeg-devices.html#gdigrab
args.AppendFormat("-f gdigrab -framerate {0} -offset_x {1} -offset_y {2} -video_size {3}x{4} -draw_mouse {5} -i desktop ",
Options.FPS, captureRectangle.X, captureRectangle.Y, captureRectangle.Width, captureRectangle.Height, 1);
args.AppendFormat("-c:v {0} ", Options.FFmpegCLI.VideoCodec.ToString());
// output FPS
args.AppendFormat("-r {0} ", Options.FPS);
args.AppendFormat("-c:v {0} ", Options.FFmpegCLI.VideoCodec.ToString());
switch (Options.FFmpegCLI.VideoCodec)
{
case FFmpegVideoCodec.libx264: // https://trac.ffmpeg.org/wiki/x264EncodingGuide