tomaszzmuda / Xabe.FFmpeg

.NET Standard wrapper for FFmpeg. It allows to process media without know how FFmpeg works, and can be used to pass customized arguments to FFmpeg from dotnet core application.

Home Page:https://xabe.net/product/xabe_ffmpeg/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't stop video with CancellationToken when AddDesktopStream

SidArtem opened this issue · comments

I tried to init stream with

FFmpeg.Conversions.New()
            .AddDesktopStream()
            .SetOutput(output)
            .Start(cts.Token);

Also i have

var cts = new CancellationTokenSource();

_ = Task.Run(async () =>
{
    await Task.Delay(5000);
    cts.Cancel();
});

After that i got System.OperationCanceledException and my video is not saved in folder.

Hello @SidArtem

Have you tried to set SetInputTime on your conversion? Maybe it will be suitable for your case.

Anyway, I'm going to investigate what happened.

I don't need concrete time for that, my case requires "start\stop" recording "buttons" when it process some work.

You can look on #454
It's not ready and not completely tested but it works in your situation.

yes, it works. thank you 🤝
waiting for the next release =)