Development setup
Get started with Video Compressor development by setting up your local environment.Install dependencies
Install the required npm packages:This installs:
electron(v25.0.0) - Development dependencyfluent-ffmpeg(v2.1.2) - FFmpeg wrapperffmpeg-static(v5.0.0) - Bundled FFmpeg binary
The application uses Electron v25.0.0. Make sure you have Node.js 14.0.0 or higher installed.
Code structure
Understanding the project structure will help you make effective contributions.Main files
main.js (29 lines)
main.js (29 lines)
Purpose: Electron main process entry pointKey responsibilities:
- Create and manage the browser window (
main.js:4-16) - Handle application lifecycle events (
main.js:18-28) - Configure security settings and Node.js integration
- Adding new windows or dialogs
- Changing window configuration
- Implementing IPC handlers
- Adding menu items or tray icons
renderer.js (81 lines)
renderer.js (81 lines)
Purpose: Renderer process logic and video compressionKey responsibilities:
- Initialize FFmpeg with bundled binary (
renderer.js:1-7) - Handle file selection and validation (
renderer.js:14-20) - Execute video compression with progress tracking (
renderer.js:32-51) - Display compressed videos (
renderer.js:57-80)
- Changing compression settings
- Adding new FFmpeg features
- Implementing additional UI interactions
- Modifying error handling or progress tracking
preload.js (11 lines)
preload.js (11 lines)
Purpose: Preload script for version informationKey responsibilities:
- Display Chrome, Node.js, and Electron versions (
preload.js:7-9) - Run before the renderer process loads
- Adding secure IPC communication
- Exposing safe APIs to the renderer
- Implementing context bridge for better security
index.html (24 lines)
index.html (24 lines)
Purpose: Application user interfaceKey components:
- File input for video selection (
index.html:11) - Compress button to trigger compression (
index.html:12) - Progress bar for visual feedback (
index.html:15-17) - Video container for displaying compressed videos (
index.html:14)
- Adding new UI elements
- Restructuring the layout
- Adding new tabs or sections
styles.css (50 lines)
styles.css (50 lines)
Purpose: Application styling and themeKey features:
- Dark theme with Discord-inspired colors (
styles.css:3-4) - Centered flexbox layout (
styles.css:7-11) - Styled buttons with hover effects (
styles.css:22-34) - Animated progress bar (
styles.css:36-49)
- Changing the color scheme
- Updating component styles
- Adding responsive design
Key functions
createWindow() - main.js:4-16
createWindow() - main.js:4-16
Creates the main application window with configured security settings.
Compression logic - renderer.js:14-55
Compression logic - renderer.js:14-55
Handles the entire video compression workflow from file selection to output.Flow:
- Validates file selection
- Reads file as ArrayBuffer
- Writes to temporary location
- Processes with FFmpeg
- Tracks progress and handles errors
- Saves to output directory
- Cleans up temporary files
Video viewer - renderer.js:57-80
Video viewer - renderer.js:57-80
Loads and displays compressed videos from the output directory.Features:
- Reads all files from
videooutputsdirectory - Filters for MP4 files
- Creates video elements with controls
- Handles loading errors
Testing approach
While the project doesn’t currently have automated tests, you should manually test your changes.Manual testing checklist
Test compression functionality
- Select various video formats (MP4, AVI, MOV, etc.)
- Verify progress bar updates correctly
- Check that compressed videos play properly
- Ensure temporary files are cleaned up
Test error handling
- Try compressing invalid or corrupted files
- Test with very large files
- Verify error messages display correctly
- Confirm temporary cleanup happens on errors
Test UI interactions
- Click “View Compressed Videos” tab
- Verify video playback controls work
- Test window resizing behavior
- Check responsive layout at different sizes
Console logging
The application includes extensive console logging for debugging:renderer.js:15,18,26,30,37,42,48
When adding new features, include similar console logging to aid debugging and testing.
How to submit contributions
Follow these guidelines when contributing to the project.Before you start
Check existing issues
Review open issues to see if your contribution is already being discussed or worked on.
Create an issue
For new features or significant changes, create an issue to discuss your proposal before starting work.
Making changes
Write clean code
- Follow the existing code style and formatting
- Add comments for complex logic
- Include console logging for debugging
- Keep functions focused and single-purpose
Submitting your contribution
Maintainers will review your pull request and may request changes or ask questions. Be responsive to feedback and willing to make adjustments.
Code review guidelines
When your PR is under review:- Respond to comments and questions promptly
- Make requested changes in new commits (don’t force push)
- Be open to suggestions and alternative approaches
- Update your PR description if the scope changes
Common contribution areas
Here are some areas where contributions are especially welcome:FFmpeg features
FFmpeg features
- Add support for more compression formats
- Implement video filters (brightness, contrast, etc.)
- Add audio compression options
- Support batch processing multiple files
User interface
User interface
- Design a settings panel for compression options
- Add drag-and-drop file support
- Implement dark/light theme toggle
- Create a better video gallery view
Security improvements
Security improvements
- Implement proper IPC communication
- Enable context isolation
- Remove direct Node.js integration
- Add input validation and sanitization
Performance optimizations
Performance optimizations
- Optimize memory usage for large files
- Add chunked file reading
- Implement compression queue
- Cache compressed videos metadata
Documentation
Documentation
- Add code comments
- Create architecture diagrams
- Write API documentation
- Add troubleshooting guides
License
This project is available under the MIT License.By contributing to this project, you agree that your contributions will be licensed under the MIT License.
MIT License terms
The MIT License is a permissive license that allows:- Commercial use
- Modification
- Distribution
- Private use
Getting help
If you need assistance while contributing:- Check existing documentation and code comments
- Review closed issues for similar problems
- Open a new issue with your question
- Reference specific files and line numbers when asking questions
Include relevant console logs, error messages, and steps to reproduce when reporting issues.