A secure client-server video processing application with encryption capabilities, built with Electron (TypeScript) frontend and Python backend.
- Video Compression: Optimize file size with dynamic quality settings
- Resolution Change: Support for 480p, 720p, 1080p, 1440p, and 4K
- Aspect Ratio Adjustment: Convert between 16:9 and 4:3 formats
- Audio Extraction: Convert videos to MP3 audio files
- GIF/WEBM Conversion: Create animated clips from video segments
- RSA Encryption: 2048-bit RSA key exchange for secure communication
- AES-256-GCM Encryption: End-to-end encryption for all file transfers
- Secure Key Storage: Client-side secure key management using Electron's safeStorage
- Client: Electron desktop application with TypeScript
- Server: Python-based processing server with FFmpeg integration
- Communication: Encrypted TCP socket connection
- File Processing: Chunked streaming with configurable rates
videoCompressor/
├── client_desktop_app/ # Electron frontend
│ ├── src/
│ │ ├── main.ts # Electron main process
│ │ ├── preload.ts # IPC bridge
│ │ ├── renderer.ts # UI logic
│ │ ├── index.html # Main interface
│ │ └── style.css # Styling
│ ├── dist/ # Compiled TypeScript
│ ├── package.json
│ └── tsconfig.json
├── server/
│ ├── server.py # Python processing server
│ ├── __init__.py
| └── storage/ # Temporary file storage
├── config.json # Configuration file
└── README.md
- Node.js (v16 or higher)
- npm (comes with Node.js)
- Git
- Python 3.11.2
- Poetry (dependency management)
- FFmpeg (video processing engine)
git clone <repository-url>
cd videoCompressor
# Install Python dependencies
poetry install
# Start the server
poetry run python server/server.py
# Navigate to client directory
cd client_desktop_app
# Install dependencies
npm install
# Build TypeScript
npm run build
# Start application
npm start
Edit config.json
to customize server settings:
{
"server_address": "127.0.0.1",
"server_port": 65432,
"max_storage": 1073741824,
"storage_dir": "/storage",
"stream_rate": 4096
}
npm start # Build and run application
npm run build # Compile TypeScript
# Python (server)
poetry add <package-name>
# Node.js (client)
cd client_desktop_app
npm install <package-name>
- Key Generation: Client generates RSA key pair on startup
- Public Key Exchange: Client and server exchange RSA public keys
- AES Key Distribution: Client generates AES-256 key, encrypts with server's RSA public key
- Secure Communication: All file data encrypted with AES-256-GCM
TypeScript (Client):
// RSA key generation
const { publicKey, privateKey } = generateKeyPairSync("rsa", {
modulusLength: 2048,
publicKeyEncoding: { type: "spki", format: "pem" },
privateKeyEncoding: { type: "pkcs8", format: "pem" }
});
// AES encryption
function encryptChunk(chunk: Buffer, key: Buffer): Buffer {
const nonce = randomBytes(12);
const cipher = createCipheriv('aes-256-gcm', key, nonce);
// ... encryption logic
}
Python (Server):
# RSA key management
class RSAManager:
def __init__(self):
self.private_key = rsa.generate_private_key(
public_exponent=65537,
key_size=2048
)
- Compression: Dynamic quality based on file size
- Resolution: 480p to 4K support
- Format Conversion: MP4, MP3, GIF, WEBM
- Aspect Ratio: 16:9, 4:3 conversion
- Time-based Clipping: Custom start/end times
The server uses FFmpeg for all video processing operations with optimized commands for each operation type.
This project was developed over 2 weeks by a 3-person team. It demonstrates:
- Full-stack development with TypeScript and Python
- Cryptographic security implementation
- Desktop application development with Electron
- Video processing with FFmpeg
- Asynchronous communication patterns
- Error handling and user experience design
- Electron: Desktop application framework
- TypeScript: Type-safe JavaScript
- HTML/CSS: Modern UI design
- Node.js: Runtime environment
- Python 3.11.2: Server implementation
- Poetry: Dependency management
- FFmpeg: Video processing
- Cryptography: Security implementation
- TCP Sockets: Client-server communication
- RSA + AES: Hybrid encryption
- Chunked Streaming: Efficient file transfer
- Launch Application: Start both server and client
- Upload Video: Click upload area to select MP4 file
- Choose Operation: Select compression, resolution change, etc.
- Configure Settings: Adjust parameters for selected operation
- Process: Click execute to start processing
- Download: Save processed file to desired location