M4S Merger Tools | 中文
✅ Graphical User Interface (GUI) | Portable (Download & Run) | No Command Line (CLI) | Built-in FFmpeg | Free
✅ Video Merging | Audio Merging | Audio & Video Muxing
✅ .M4S | .MP4 | .MP3
🌐 Online Version (Click-to-Run) ➡️ Web Counterpart | https://github.com/MaxMiksa/M4S-Merger-Tools-Web
🖥️ Offline Version (Portable) ➡️ This Repo | https://github.com/MaxMiksa/M4S-Merger-Tools
| Feature | Description |
|---|---|
| 🎬 Video Merging | Combines multiple M4S video fragments into a single complete video file. |
| 🎵 Audio Merging | Combines multiple M4S audio fragments into a single complete audio file. |
| 🎞️ Audio/Video Muxing (Remixing) | Merges separate M4S video and audio files into one complete MP4 file (containing both picture and sound). |
| 🚀 One-Click Automation | Fully automated workflow, including environment setup (FFmpeg download), error reporting/resolution, and combined audio/video processing. |
| 💻 Customizable GUI | A user-friendly, click-and-run visual interface, eliminating command-line hassle. Supports switching between Chinese/English and light/dark modes. |
| 📝 Real-time Progress Display | Shows detailed processing progress and log information in real-time. |
| ⚙️ Automatic FFmpeg Setup | Automatically detects and installs FFmpeg on first run if needed (supports custom download and installation paths). |
| 🛡️ Robust Error Handling | Provides detailed error prompts at every stage to help users quickly identify and resolve issues. |
This project is built using the following technologies:
- Language: Python 3.7+
- GUI Framework:
customtkinter(Modern UI wrapper for Tkinter),tkinter(Native Python GUI) - Image Processing:
Pillow(PIL Fork) - Core Processing:
FFmpeg(External command-line tool for video/audio processing) - Packaging:
PyInstaller(converts Python scripts into executable .exe) - System Interaction:
subprocess,os,sys,pathlib,threading(Standard Python Libraries)
- Select Video Files: Click the "Select Video Files" button to choose the M4S video fragments to be merged.
- Select Audio Files: Click the "Select Audio Files" button to choose the M4S audio fragments to be merged.
- Select Output Directory: Click the "Select Output Directory" button to choose the save location for the result file (it defaults to your Desktop automatically if you skip this step).
- Execute Processing:
- Merge Video Only: Merges video fragments only.
- Merge Audio Only: Merges audio fragments only.
- One-Click Muxing: Automatically completes video merging, audio merging, and muxing (Recommended).
All exports now carry 24-hour timestamps accurate to the second so that repeated runs never overwrite each other:
Merged_Video_YYYY-MM-DD_HH-MM-SS.mp4: The merged video file.Merged_Audio_YYYY-MM-DD_HH-MM-SS.mp4: The merged audio file.Muxed_Output_YYYY-MM-DD_HH-MM-SS.mp4: The final muxed file. Intermediate merged files are kept in a temporary directory—your output folder only receives this final MP4.
- If downloading the EXE file: Windows 10/11
- If running from source code: Python 3.7 or higher
- Download
M4S Merger Tools.exefrom theReleasesection on the right side of this interface. - Run
M4S Merger Tools.exe. Note: Internet connection is required for the first run (for automatic FFmpeg download).
Alternative: Running from Source Code
If Python is not installed, download and install it from the Python official website.
- Download or clone this project.
- Double-click
start.bat.
Upon the first run, if the program detects that FFmpeg is not installed, an installation dialog will pop up:
- Select the installation directory for FFmpeg (defaults to the
ffmpegfolder in the user's home directory). - Click the "Install" button.
- The program will:
- Automatically download FFmpeg (approx. 100MB, takes about 10 seconds).
- Automatically extract it to the specified directory.
- Automatically add it to the system PATH environment variable.
- After installation, restart the program to use it.
Alternative: Detailed Steps (Manual FFmpeg Installation)
1. Download the Windows version from the [FFmpeg official website](https://ffmpeg.org/download.html). 2. Extract it to any directory (e.g., `C:\ffmpeg`). 3. Add FFmpeg's `bin` directory to the system PATH environment variable: - Right-click "This PC" → "Properties" → "Advanced system settings" → "Environment Variables". - Under "System variables," find `Path` and click "Edit". - Add the path to the FFmpeg `bin` directory (e.g., `C:\ffmpeg\bin`). - Click "OK" to save.- File Order: Merging is performed according to the order in which files were selected in the dialog; please ensure the file sequence is correct.
- File Format: Currently, the primary support is for M4S format; other formats may work but have not been fully tested.
- FFmpeg Path: If FFmpeg is not in the system PATH, you can modify the
ffmpeg_pathparameter in the source code. - Processing Time: Processing large files may take a significant amount of time; please be patient.
- Network Connection: An internet connection is required for the first run to download FFmpeg.
Packaging as an Executable (If running from source code, not using the downloaded EXE)
The program provides three methods to package it into a standalone .exe file, allowing it to run without Python installed.
- Double-click
build_exe.bat. - The script will automatically install PyInstaller (if not installed) and begin packaging.
- The executable file will be located in
dist\M4S Merger Tools v1.x.0.exe.
python build_exe.py# Install PyInstaller
pip install pyinstaller
# Package (using the batch script)
build_exe.bat
# Or directly use PyInstaller
pyinstaller --onefile --windowed --name "M4S Merger Tools v1.x.0" main.pyThe packaged .exe file can be:
- Copied to any Windows computer and run directly.
- Shared with other users via USB drives or cloud storage.
- Upon first run, the program automatically detects and installs FFmpeg as needed (requires network connection).
Comprehensive Error Prompts and Handling Mechanism
The program includes a comprehensive error handling mechanism, displaying detailed error prompts at every stage.
- Python version check
- Module import check
- GUI initialization check
- File selection error prompts
- FFmpeg call error prompts
- File processing error prompts
- Network connection error prompts
- FFmpeg download error prompts
- Extraction error prompts
- PATH addition error prompts
If the program fails to respond:
- Check for error pop-up windows (they might be hidden behind other windows).
- Check if a process is running in the Task Manager.
- Try running as administrator.
- Check the program's log output (if running from source code).
FAQ
A: The program automatically checks for FFmpeg on the first run. If it's not installed, an installation dialog will appear—follow the instructions. If it is installed but the program can't detect it, ensure FFmpeg is added to the system PATH environment variable, and then restart the program.
A: Possible reasons include:
- Network connection issues: Check your internet connection.
- Insufficient disk space: FFmpeg requires about 200MB of space.
- Permission issues: Ensure you have write permissions for the installation directory.
If automatic installation fails, you can install FFmpeg manually (refer to the manual installation instructions in the "Installation" section).
A: Please check:
- Whether an error prompt window appeared (it might be hidden).
- If a process is running in the Task Manager.
- Try running as administrator.
- If using the EXE file, ensure the file is complete and not blocked by antivirus software.
A: Please ensure that you have selected both video and audio files and used the "One-Click Muxing" feature to combine the streams.
A: Check the error message in the log output area. Common causes include:
- File paths containing special characters.
- Corrupted files.
- Insufficient disk space.
- FFmpeg version incompatibility.
- Network connection issues (during FFmpeg download).
Technical Details
- GUI Framework: Python tkinter
- Video Processing: FFmpeg
- Error Handling: Comprehensive exception capturing and user notification mechanism
License
This project is licensed under the MIT License.
Welcome to submit Issues and Pull Requests!
Any questions or suggestions? Please contact Max Kong (Carnegie Mellon University, Pittsburgh, PA).
Max Kong: kongzheyuan@outlook.com | zheyuank@andrew.cmu.edu


