mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
using ffmpeg gdigrab instead directshow filter
This commit is contained in:
parent
bb25962bd8
commit
cf9ea2f99d
1 changed files with 11 additions and 5 deletions
|
@ -61,6 +61,9 @@ private void FFmpegCLIHelper_OutputDataReceived(object sender, DataReceivedEvent
|
||||||
|
|
||||||
public bool Record(Rectangle captureRectangle)
|
public bool Record(Rectangle captureRectangle)
|
||||||
{
|
{
|
||||||
|
StringBuilder args = new StringBuilder();
|
||||||
|
|
||||||
|
/*
|
||||||
// https://github.com/rdp/screen-capture-recorder-to-video-windows-free configuration section
|
// https://github.com/rdp/screen-capture-recorder-to-video-windows-free configuration section
|
||||||
string dshowRegistryPath = "Software\\screen-capture-recorder";
|
string dshowRegistryPath = "Software\\screen-capture-recorder";
|
||||||
RegistryHelpers.CreateRegistry(dshowRegistryPath, "start_x", captureRectangle.X);
|
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, "capture_height", captureRectangle.Height);
|
||||||
RegistryHelpers.CreateRegistry(dshowRegistryPath, "default_max_fps", Options.FPS);
|
RegistryHelpers.CreateRegistry(dshowRegistryPath, "default_max_fps", Options.FPS);
|
||||||
|
|
||||||
StringBuilder args = new StringBuilder();
|
|
||||||
|
|
||||||
// input FPS
|
// input FPS
|
||||||
args.AppendFormat("-r {0} ", Options.FPS);
|
args.AppendFormat("-r {0} ", Options.FPS);
|
||||||
|
|
||||||
args.Append("-f dshow -i ");
|
args.Append("-f dshow -i ");
|
||||||
|
|
||||||
// dshow audio/video device: https://github.com/rdp/screen-capture-recorder-to-video-windows-free
|
// 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");
|
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
|
// output FPS
|
||||||
args.AppendFormat("-r {0} ", Options.FPS);
|
args.AppendFormat("-r {0} ", Options.FPS);
|
||||||
|
|
||||||
args.AppendFormat("-c:v {0} ", Options.FFmpegCLI.VideoCodec.ToString());
|
|
||||||
|
|
||||||
switch (Options.FFmpegCLI.VideoCodec)
|
switch (Options.FFmpegCLI.VideoCodec)
|
||||||
{
|
{
|
||||||
case FFmpegVideoCodec.libx264: // https://trac.ffmpeg.org/wiki/x264EncodingGuide
|
case FFmpegVideoCodec.libx264: // https://trac.ffmpeg.org/wiki/x264EncodingGuide
|
||||||
|
|
Loading…
Reference in a new issue