A shell script to extract, combine, and convert Preply lesson recording files into a single MP3 audio file.
Preply provides lesson recordings as downloadable ZIP files containing multiple WebM segments. However, these files are originally streaming files and cannot be played directly. This script combines them into a single playable MP3 file.
-
ffmpeg: Required for audio conversion and concatenation
- macOS:
brew install ffmpeg - Ubuntu/Debian:
sudo apt install ffmpeg - Windows: Download from ffmpeg.org
- macOS:
-
unzip: Usually pre-installed on most systems
Note: This script has been tested on macOS. Windows compatibility has not been verified.
-
Clone or download this repository
-
Make the script executable:
chmod +x combine_audio.sh
-
Edit the script to update the file paths for your system:
# Path to ZIP file to extract zip_file="/path/to/your/Downloads/lesson_recordings.zip" # Extraction destination directory input_dir="$HOME/Downloads/lesson_recordings" # Output directory output_dir="/path/to/your/output/directory/"
- Download your lesson recordings ZIP file from Preply
- On macOS, this will automatically be saved to
/Users/[your-username]/Downloads/lesson_recordings.zip - The script expects the file to be named exactly
lesson_recordings.zip
- On macOS, this will automatically be saved to
- Update the script paths if your username or download location differs from the default
- Run the script:
./combine_audio.sh
- Extracts the ZIP file containing WebM segments
- Validates that all required
part_XX.webmfiles are present - Combines all segments using ffmpeg
- Converts to MP3 format with 192k bitrate
- Saves the final file with today's date:
YYYY_MM_DD_Preply_audio.mp3 - Cleans up by removing the ZIP file and extracted files
The script expects WebM files in the format:
part_01.webm
part_02.webm
part_03.webm
...
The combined audio file will be saved as:
YYYY_MM_DD_Preply_audio.mp3
- "lesson_recordings.zip not found": Check the ZIP file path in the script
- "No extracted files found": Verify the ZIP contains
part_XX.webmfiles - "Concatenation failed": Ensure ffmpeg is installed and accessible
MIT License - Feel free to modify and distribute.
Issues and pull requests welcome!