first-last-frame
1767.774.631.541
dotnet add package first-last-frame --version 1767.774.631.541
NuGet\Install-Package first-last-frame -Version 1767.774.631.541
<PackageReference Include="first-last-frame" Version="1767.774.631.541" />
<PackageVersion Include="first-last-frame" Version="1767.774.631.541" />
<PackageReference Include="first-last-frame" />
paket add first-last-frame --version 1767.774.631.541
#r "nuget: first-last-frame, 1767.774.631.541"
#:package first-last-frame@1767.774.631.541
#addin nuget:?package=first-last-frame&version=1767.774.631.541
#tool nuget:?package=first-last-frame&version=1767.774.631.541
first-last-frame
A .NET library to efficiently extract the first and last frames from video files. This package simplifies the process of retrieving representative images from video content for various applications.
Installation
To install the first-last-frame package, use the following command in your .NET project:
bash
dotnet add package first-last-frame
Usage Examples
Here are a few examples demonstrating how to use the first-last-frame package in your C# code:
Example 1: Extracting frames and saving them to disk. csharp using FirstLastFrame;
public class Example { public static async Task Main(string[] args) { string videoPath = "path/to/your/video.mp4"; string firstFramePath = "path/to/save/first_frame.jpg"; string lastFramePath = "path/to/save/last_frame.jpg";
try
{
await FrameExtractor.ExtractFirstAndLastFramesAsync(videoPath, firstFramePath, lastFramePath);
Console.WriteLine("First and last frames extracted successfully!");
}
catch (Exception ex)
{
Console.WriteLine($"An error occurred: {ex.Message}");
}
}
}
Example 2: Extracting frames and retrieving them as byte arrays. csharp using FirstLastFrame;
public class Example2 { public static async Task Main(string[] args) { string videoPath = "path/to/your/video.mp4";
try
{
(byte[] firstFrameBytes, byte[] lastFrameBytes) = await FrameExtractor.ExtractFirstAndLastFramesBytesAsync(videoPath);
// Process the byte arrays (e.g., save to database, display in UI)
Console.WriteLine($"First frame byte array length: {firstFrameBytes.Length}");
Console.WriteLine($"Last frame byte array length: {lastFrameBytes.Length}");
}
catch (Exception ex)
{
Console.WriteLine($"An error occurred: {ex.Message}");
}
}
}
Example 3: Handling potential exceptions (e.g., invalid video format). csharp using FirstLastFrame;
public class Example3 { public static async Task Main(string[] args) { string videoPath = "path/to/your/video.mp4"; string firstFramePath = "path/to/save/first_frame.jpg"; string lastFramePath = "path/to/save/last_frame.jpg";
try
{
await FrameExtractor.ExtractFirstAndLastFramesAsync(videoPath, firstFramePath, lastFramePath);
Console.WriteLine("First and last frames extracted successfully!");
}
catch (FileNotFoundException)
{
Console.WriteLine("Video file not found.");
}
catch (InvalidOperationException)
{
Console.WriteLine("Invalid video format or codec.");
}
catch (Exception ex)
{
Console.WriteLine($"An unexpected error occurred: {ex.Message}");
}
}
}
Example 4: Specifying the output image format csharp using FirstLastFrame;
public class Example4 { public static async Task Main(string[] args) { string videoPath = "path/to/your/video.mp4"; string firstFramePath = "path/to/save/first_frame.png"; // Save as PNG string lastFramePath = "path/to/save/last_frame.bmp"; // Save as BMP
try
{
await FrameExtractor.ExtractFirstAndLastFramesAsync(videoPath, firstFramePath, lastFramePath);
Console.WriteLine("First and last frames extracted successfully!");
}
catch (Exception ex)
{
Console.WriteLine($"An error occurred: {ex.Message}");
}
}
}
Feature Summary
- Efficient Frame Extraction: Quickly retrieves the first and last frames from a video.
- Asynchronous Operations: Utilizes asynchronous methods for non-blocking execution.
- Byte Array Output: Provides an option to retrieve frames as byte arrays for flexible processing.
- Exception Handling: Includes robust exception handling for common video processing errors.
- Simple API: Easy-to-use API for seamless integration into your .NET projects.
- Multiple Image Format Support: Saves frames in different formats (JPEG, PNG, BMP, etc.) based on the file extension.
License
MIT License
This package is part of the first-last-frame ecosystem. For advanced features and enterprise-grade tools, visit: https://supermaker.ai/video/first-last-frame/
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1767.774.631.541 | 126 | 1/7/2026 |