Coder Social home page Coder Social logo

frame_extractor's Introduction

Keyframe Extractor Microservice

Part of Video Search Engine Project

This repository contains a Flask-based web service that extracts keyframes from uploaded videos using Structural Similarity Index (SSIM) and Mean Squared Error (MSE) as metrics. The extracted keyframes are then zipped and can be posted to another service.

Features

  • Extract keyframes from video using SSIM or MSE.
  • Save extracted keyframes to a specified directory.
  • Zip the keyframes directory for easy transfer.
  • REST API endpoints for checking service status and extracting keyframes.
  • Supports both Standalone and Chained modes.

Modes

  • Standalone Mode: Extracted keyframes are zipped and provided directly for download.
  • Chained Mode: Extracted keyframes are zipped and then posted to 'Vision Transformer' microservice for further processing.

Installation

  1. Clone the repository:
    git clone https://github.com/iam-VK/frame_extractor.git
    cd frame_extractor
  2. Install the required dependencies:
    ./setup.sh

Usage

  1. Run the Flask application:
    ./run.sh
  2. The service will be available at http://0.0.0.0:5001

Endpoints

  • Service Status

    • URL: /
    • Method: GET or POST
    • Response:
    {
        "status": "Alive",
        "endpoints": {
            "/keyframe_extract": {
                "method":"[POST]",
                "paramaters": {
                        "file_upload":"video file for keyframes extraction",
                        "mode":"optional parameter, can be 'standalone' or 'chained' (default: 'chained')"
                    }
                }
            }
        }
  • Keyframe Extraction

    • URL: /keyframe_extract
    • Method: POST
    • Request: Multipart form data with video file (file_upload) and mode (optional)
    • Response:
    {
        "Frame Extractor service": {
            "Status": "Success",
            "keyframes_extracted": <number of keyframes extracted>
        },
        "File URL": "<URL to download the zipped keyframes>" // Only in standalone mode
        "ViT service": {<response from the chained service>} // Only in chained mode
    }

Project Structure

    frame_extractor/
    ├── app.py                # Flask application
    ├── api_requests.py       # Utility for multipart POST request
    ├── frame_extractor.py    # Functions to extract keyframes from video
    ├── zipper.py             # Utility to zip directories
    ├── requirements.txt      # List of dependencies
    ├── README.md             # Project README
    ├── setup.sh              # Setup virtual env and install dependencies
    ├── run.sh                # Starts the microservice  
    └── clean_cache.sh        # Deletes the cache files and cache directories 
    |──────────────Cache files──────────────
    ├── uploads               # Uploaded videos
    ├── key_frames            # Extracted keyframes
    └── key_frames.zip        # Extracted keyframes zipped and ready to ship
    

frame_extractor's People

Contributors

iam-vk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.