# poojadesai4512/video-steganography architecture

> Architecture diagram of the GitHub repository poojadesai4512/video-steganography, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/poojadesai4512/video-steganography
- Repository: https://github.com/poojadesai4512/video-steganography

## Overview

##### Main components
- Web Server: At the heart of the system is the Flask web server that provides two separate web interfaces – one for encryption and one for decryption. (In the README, these are represented by app.py and decrypt_app.py.)
- Encryption/Embedding Engine: This part handles the process of taking a secret message, encrypting it using Blowfish, converting the cipher text into fake DNA, and then embedding it into the selected video frames (using DCT-based complex frame selection).
- Decryption/Extraction Engine: This reverses the encryption process: it extracts hidden data from the video, decodes the fake DNA back into cipher text, and then decrypts the message using the same Blowfish encryption key.
- Video Processing Module: Since the project deals with video files (using OpenCV and NumPy), include this module that handles reading frames, applying DCT analysis for frame selection, and writing the resulting stego video.
- File Storage/Handling: There are components handling uploads and static file storage (as indicated in README with directories like “Static” and “Uploads”). Video files flow from upload to processing, then the processed (stego) video can be downloaded or viewed.
- User Interface (Templates): The HTML template files (index_new.html, index_decryption_new.html, and result_new.html) form the front end that interacts with users.

##### Relationships and interactions between components
- User Interactions: Users access the encryption or decryption endpoint through the web interface. The interface collects the video file and secret message (or the stego video and decryption key) from the client.
- Data Flow in Encryption:
- The user uploads a video and provides a secret message.
- The web server routes the request to the Encryption Engine.
- The Encryption Engine uses the Blowfish module to encrypt the text and then converts it to fake DNA.
- The Video Processing Module embeds the encoded data into the selected video frames (based on DCT analysis).
- The final stego video is stored (or made available in the “Static”/“Uploads” directories) and then sent back to the user.
- Data Flow in Decryption:
- The user uploads the stego video along with the decryption key.
- The web server routes this request to the Decryption Engine.
- The Video Processing Module locates and extracts the hidden data.
- The Decryption Engine decodes the fake DNA back to cipher text and then uses Blowfish decryption to retrieve the original message.
- The result is rendered on a result template.
- External Library Dependencies: Python libraries like OpenCV and NumPy are crucial for video processing. Flask forms the backbone of your web server, and Blowfish encryption routines play a critical role in the security aspect.

##### Important architectural patterns
- Separation of Concerns: The system cleanly separates the user interface (HTML templates), web business logic (Flask apps), and the core processing (encryption/decryption and video processing).
- MVC-like (loosely) in the web interface: The HTML templates serve as the “views,” the Flask app as the “controller,” and the processing modules act similar to the “model” layer in that they handle the business logic.

##### Relevant technologies, frameworks, and libraries
- Python is the core language.
- Flask is used for the web server (with separate routes for encryption and decryption).
- OpenCV and NumPy help with video processing and complex frame analysis (DCT).
- Blowfish encryption routines (potentially either implemented or imported from a library).
- HTML files act as the front end.

##### Summing up
- A front-end layer (HTML templates – encryption interface and decryption interface)
- The Flask-based web server that routes requests to the respective processing engines.
- The Encryption Engine, with steps including Blowfish encryption, fake DNA encoding, and DCT-based frame selection within the Video Processing Module.
- The Decryption Engine with the reversed steps.
- File Storage/Handling indicating directories for uploads and processed videos.
- External libraries and frameworks supporting each part of the system.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% User Interface Layer
    subgraph "User Interface"
        UI_E1["Encryption Interface"]:::ui
        UI_E2["Encryption Fallback"]:::ui
        UI_D1["Decryption Interface"]:::ui
        UI_D2["Decryption Fallback"]:::ui
        UI_R1["Result Page"]:::ui
        UI_R2["Result Fallback"]:::ui
    end

    %% Web Server Layer
    subgraph "Web Server Layer"
        WS_E["Flask Web Server (Encryption)"]:::web
        WS_D["Flask Web Server (Decryption)"]:::web
    end

    %% Processing Engines
    subgraph "Processing Engines"
        ENC["Encryption/Embedding Engine"]:::proc
        DEC["Decryption/Extraction Engine"]:::proc
    end

    %% Video Processing Module
    subgraph "Video Processing Module"
        VP["Video Processing (OpenCV & NumPy)"]:::video
    end

    %% File Storage/Handling Module
    subgraph "File Storage/Handling"
        FS["Uploaded/Processed Videos"]:::storage
    end

    %% External Dependencies
    subgraph "External Dependencies"
        BF["Blowfish Encryption"]:::crypto
        OP["OpenCV Library"]:::lib
        NP["NumPy Library"]:::lib
    end

    %% Encryption Flow
    UI_E1 -->|"uploadVideoSecret"| WS_E
    WS_E -->|"routeToEncoding"| ENC
    ENC -->|"encryptUsingBlowfish"| BF
    ENC -->|"encodeToFakeDNA"| VP
    VP -->|"embedWithDCT"| FS
    FS -->|"provideStegoVideo"| UI_R1
    WS_E -->|"renderResult"| UI_R1

    %% Decryption Flow
    UI_D1 -->|"uploadStegoVideoKey"| WS_D
    WS_D -->|"routeToDecoding"| DEC
    DEC -->|"extractHiddenData"| VP
    VP -->|"selectFramesWithDCT"| FS
    DEC -->|"decryptUsingBlowfish"| BF
    WS_D -->|"renderResult"| UI_R1

    %% Shared relationships
    ENC --> VP
    DEC --> VP
    VP -->|"uses"| OP
    VP -->|"uses"| NP

    %% Click Events
    click WS_E "https://github.com/poojadesai4512/video-steganography/blob/main/app_e.py"
    click ENC "https://github.com/poojadesai4512/video-steganography/blob/main/app_e.py"
    click WS_D "https://github.com/poojadesai4512/video-steganography/blob/main/app_check.py"
    click DEC "https://github.com/poojadesai4512/video-steganography/blob/main/app_check.py"
    click FS "https://github.com/poojadesai4512/video-steganography/blob/main/input_video.mp4"
    click UI_E1 "https://github.com/poojadesai4512/video-steganography/blob/main/index_new.html"
    click UI_E2 "https://github.com/poojadesai4512/video-steganography/blob/main/index.html"
    click UI_D1 "https://github.com/poojadesai4512/video-steganography/blob/main/index_decryption_new.html"
    click UI_D2 "https://github.com/poojadesai4512/video-steganography/blob/main/index_decryption.html"
    click UI_R1 "https://github.com/poojadesai4512/video-steganography/blob/main/result_new.html"
    click UI_R2 "https://github.com/poojadesai4512/video-steganography/blob/main/result.html"

    %% Styles
    classDef web fill:#f9f,stroke:#333,stroke-width:2px;
    classDef proc fill:#ccf,stroke:#333,stroke-width:2px;
    classDef video fill:#cfc,stroke:#333,stroke-width:2px;
    classDef storage fill:#fcf,stroke:#333,stroke-width:2px;
    classDef ui fill:#ffc,stroke:#333,stroke-width:2px;
    classDef crypto fill:#cff,stroke:#333,stroke-width:2px;
    classDef lib fill:#fcc,stroke:#333,stroke-width:2px;
```
