Compare commits
1 Commits
own-wrappe
...
xabe
| Author | SHA1 | Date | |
|---|---|---|---|
| eca4ab0f15 |
@@ -1,27 +0,0 @@
|
|||||||
using Xabe.FFmpeg;
|
|
||||||
using Xabe.FFmpeg.Downloader;
|
|
||||||
|
|
||||||
namespace Flashcap_Demo;
|
|
||||||
|
|
||||||
public class FFmpeg
|
|
||||||
{
|
|
||||||
public static Task DownloadBackground()
|
|
||||||
{
|
|
||||||
return FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official, new Progress<ProgressInfo>(info =>
|
|
||||||
{
|
|
||||||
if (info.TotalBytes<=1)return;
|
|
||||||
var percentageDone = (double)info.DownloadedBytes / info.TotalBytes;
|
|
||||||
Console.Write($"Downloaded {FormatBytes(info.DownloadedBytes)} of {FormatBytes(info.TotalBytes)}, {FormatPercentage(percentageDone)}\r");
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string FormatBytes(long bytes)
|
|
||||||
{
|
|
||||||
return $"{bytes / 1000000.0d:#00.00}MB";
|
|
||||||
}
|
|
||||||
private static string FormatPercentage(double percentage)
|
|
||||||
{
|
|
||||||
return $"{percentage*100:00.00}%";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -10,8 +10,9 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="FlashCap" Version="1.11.0" />
|
<PackageReference Include="FlashCap" Version="1.11.0" />
|
||||||
<PackageReference Include="Terminal.Gui" Version="2.0.0-alpha.3931" />
|
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
|
||||||
<PackageReference Include="Xabe.FFmpeg.Downloader" Version="6.0.2" />
|
<PackageReference Include="System.Reactive" Version="6.1.0" />
|
||||||
|
<PackageReference Include="Xabe.FFmpeg" Version="6.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,20 +1,13 @@
|
|||||||
|
|
||||||
using FlashCap;
|
using FlashCap;
|
||||||
using Terminal.Gui.App;
|
using Xabe.FFmpeg;
|
||||||
using Terminal.Gui.Configuration;
|
|
||||||
using Terminal.Gui.ViewBase;
|
|
||||||
using Terminal.Gui.Views;
|
|
||||||
|
|
||||||
namespace Flashcap_Demo;
|
namespace Flashcap_Demo;
|
||||||
|
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
public static async Task Main(string[] args)
|
public async static Task Main(string[] args)
|
||||||
{
|
{
|
||||||
var backgroundDownload = FFmpeg.DownloadBackground();
|
|
||||||
var app = Application.Create();
|
|
||||||
app.Run<MainWindow>();
|
|
||||||
app.Dispose();
|
|
||||||
var device = new CaptureDevices();
|
var device = new CaptureDevices();
|
||||||
var deviceDescriptors = device.GetDescriptors()
|
var deviceDescriptors = device.GetDescriptors()
|
||||||
.Where(x=>x.Characteristics.Length > 0)
|
.Where(x=>x.Characteristics.Length > 0)
|
||||||
@@ -28,22 +21,29 @@ internal static class Program
|
|||||||
Console.WriteLine($"Chosen:\n\t" +
|
Console.WriteLine($"Chosen:\n\t" +
|
||||||
$"{captureDeviceDescriptor}\n\t" +
|
$"{captureDeviceDescriptor}\n\t" +
|
||||||
$"{characteristic}");
|
$"{characteristic}");
|
||||||
if (!backgroundDownload.IsCompleted)
|
|
||||||
{
|
|
||||||
await backgroundDownload;
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine("We have both a selected Device and FFmpeg");
|
var cancellationTokenSource = new CancellationTokenSource();
|
||||||
|
var mediaInfo = await FFmpeg.GetMediaInfo(captureDeviceDescriptor.Identity.ToString(), cancellationTokenSource.Token);
|
||||||
|
|
||||||
|
var outName = Path.Join(Directory.GetCurrentDirectory(),"output");
|
||||||
|
|
||||||
|
var parameters =
|
||||||
|
$"-f v4l2 " +
|
||||||
|
$"-framerate {characteristic.FramesPerSecond} " +
|
||||||
|
$"-video_size {characteristic.Width}x{characteristic.Height} " +
|
||||||
|
$"-input_format mjpeg " +
|
||||||
|
$"-y " +
|
||||||
|
$"-report " +
|
||||||
|
$"-i {captureDeviceDescriptor.Identity} " +
|
||||||
|
$"{outName}.mkv";
|
||||||
|
FFmpeg.Conversions.New()
|
||||||
|
.Start(parameters, cancellationTokenSource.Token);
|
||||||
|
// .Build();
|
||||||
|
// Console.WriteLine(cli);
|
||||||
|
|
||||||
|
Console.WriteLine(parameters);
|
||||||
|
await Task.Delay(5000);
|
||||||
|
cancellationTokenSource.Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class MainWindow : Window
|
|
||||||
{
|
|
||||||
public MainWindow()
|
|
||||||
{
|
|
||||||
Title = "CapEd";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user