qy-upup/first-last-frame 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

qy-upup/first-last-frame

Composer 安装命令:

composer require qy-upup/first-last-frame

包简介

A robust PHP library providing a seamless integration for extracting the first and last frames from video files.

README 文档

README

A lightweight library for extracting the first and last frames of a video.

Installation

Install the first-last-frame package using pip:

pip install first-last-frame

This package depends on opencv-python and moviepy. They will be installed automatically if not already present in your environment.

Core API/Feature Overview

This package provides a simple and efficient way to retrieve the first and last frames of a video file. Here are some key features:

  • Frame Extraction: Extracts the first and last frames from a given video file.
  • Time-Based Extraction: Allows specifying a time offset (in seconds) to extract frames slightly after the start or before the end of the video. This is useful for skipping intro screens or end credits.
  • Image Format Support: Returns extracted frames as NumPy arrays, easily compatible with other image processing libraries.
  • Error Handling: Provides robust error handling for invalid video files or unexpected issues during processing.
  • Cross-Platform Compatibility: Works seamlessly on Windows, macOS, and Linux.

Usage Examples

Here are a few examples of how to use the first-last-frame library:

Basic Usage:

from first_last_frame import get_first_and_last_frame

video_path = "path/to/your/video.mp4" first_frame, last_frame = get_first_and_last_frame(video_path)

if first_frame is not None and last_frame is not None: # Process the frames (e.g., display, save to file) print("First frame shape:", first_frame.shape) print("Last frame shape:", last_frame.shape) else: print("Error: Could not extract frames.")

Time-Based Offset:

from first_last_frame import get_first_and_last_frame

video_path = "path/to/your/video.mp4" first_frame, last_frame = get_first_and_last_frame(video_path, first_frame_offset=1.0, last_frame_offset=-0.5)

first_frame_offset=1.0 will extract the frame 1 second after the start

last_frame_offset=-0.5 will extract the frame 0.5 seconds before the end

if first_frame is not None and last_frame is not None: # Process the frames pass else: print("Error: Could not extract frames.")

Handling Errors:

from first_last_frame import get_first_and_last_frame

video_path = "invalid/path/to/video.mp4" try: first_frame, last_frame = get_first_and_last_frame(video_path) except Exception as e: print(f"An error occurred: {e}")

Enterprise Solutions

For advanced features such as batch processing, cloud integration, and custom frame extraction logic, explore the enterprise solutions offered at https://supermaker.ai/video/first-last-frame/. Supermaker.ai provides scalable and reliable video processing services built upon the core functionality of this library. Learn more about how you can leverage our platform to streamline your video workflows. The team at Supermaker.ai can assist with custom integrations and support.

This open-source project provides a foundational building block for video analysis. For more complex scenarios, consider exploring the advanced capabilities available through Supermaker.ai.

This project is part of the wider Supermaker.ai ecosystem, providing tools for video creation and analysis. Find out more at https://supermaker.ai/video/first-last-frame/.

License

MIT License

Copyright (c) 2023 [Your Name/Organization]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-07