Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop Capture #7

Closed
JDCain opened this issue Feb 21, 2019 · 2 comments
Closed

Desktop Capture #7

JDCain opened this issue Feb 21, 2019 · 2 comments
Labels
question Further information is requested

Comments

@JDCain
Copy link

JDCain commented Feb 21, 2019

Would it be possible to use this for Desktop Capture on Windows?
the demo command is "ffmpeg -f dshow -i video="screen-capture-recorder" output.mkv"

Edit: "-f dshow -i video="screen-capture-recorder" output.mkv" does not work since I don't have "screen-capture-recorder" installed. There was no error thrown though.

"-f gdigrab -framerate 30 -i desktop output.mkv" Does work but I am not sure how to stop it.

@JDCain
Copy link
Author

JDCain commented Feb 22, 2019

I was not able to get this to work using the current framework implementation but I was able to do it directly with the following code:

        var si = new ProcessStartInfo
        {
            Arguments = "-y -f gdigrab -framerate 10 -video_size 1920x1080 -i desktop output.mp4",
            FileName = _fixture.FFmpegPath,
            RedirectStandardInput = true,            
        };

        var ffmpegProcess = Process.Start(si);
        await Task.Delay(15000);
        ffmpegProcess.StandardInput.Write("q");
        ffmpegProcess.WaitForExit();

@cmxl cmxl added bug Something isn't working enhancement New feature or request labels Mar 11, 2019
@cmxl
Copy link
Owner

cmxl commented Apr 26, 2019

Hi @JDCain !

I just tried what you wanted to do and I got it to work with the following example:

var cancelSource = new CancellationTokenSource();
var task = ffmpeg.ExecuteAsync(@"-y -f gdigrab -framerate 10 -video_size 1920x1080 -i desktop C:\Temp\output.mp4", cancelSource.Token);
await Task.Delay(15000);
cancelSource.Cancel();
await task;

Be aware that cancelling throws an exception.
The ffmpeg process will be gracefully terminated since this pullrequest: #11

The new version is not yet published on nuget.
But this will be done tonight ;)

@cmxl cmxl closed this as completed Apr 26, 2019
@cmxl cmxl added question Further information is requested and removed bug Something isn't working enhancement New feature or request labels Apr 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants