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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="first-last-frame" Version="1767.774.631.541" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="first-last-frame" Version="1767.774.631.541" />
                    
Directory.Packages.props
<PackageReference Include="first-last-frame" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add first-last-frame --version 1767.774.631.541
                    
#r "nuget: first-last-frame, 1767.774.631.541"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package first-last-frame@1767.774.631.541
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=first-last-frame&version=1767.774.631.541
                    
Install as a Cake Addin
#tool nuget:?package=first-last-frame&version=1767.774.631.541
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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