Scripts and shortcuts for editing audio/video (e.g batch ffmpeg commands).
A Python script for Windows 11 that automates the workflow of extracting audio from videos, editing it in a DAW (like Reaper), and merging the edited audio back with the original videoβall without re-encoding the video.
This tool is perfect for content creators who need to:
- Extract audio from videos for editing in a DAW
- Replace video audio with professionally edited tracks
- Maintain original video quality (no re-encoding)
- Process multiple videos in batch
- Extract audio from MP4 videos without re-encoding (preserves original quality)
- Merge edited audio (WAV format) back with original video
- No video re-encoding - keeps original video stream intact
- High-quality audio encoding - 320 kbps AAC for maximum quality
- Batch processing - handles multiple videos automatically
- Detailed logging - see exactly what's happening at every step
- Social media ready - outputs MP4 files compatible with Instagram, YouTube, TikTok
- Python 3.6 or higher
- Check if installed:
python --versionin Command Prompt
- Download FFmpeg from: https://www.gyan.dev/ffmpeg/builds/
- Get ffmpeg-release-essentials.zip
- Extract to
C:\ffmpeg
- Press
Win + Xβ System β Advanced system settings - Click Environment Variables
- Under "System variables", find
Pathβ Edit β New - Add:
C:\ffmpeg\bin - Click OK on all dialogs
- Restart any open Command Prompt windows
ffmpeg -versionYou should see FFmpeg version information.
- Clone this repository:
git clone https://github.com/yourusername/ffmpeg-video-processor.git
cd ffmpeg-video-processor- No additional dependencies needed - uses Python standard library only!
python process_videos.py "C:\path\to\your\video\folder"python process_videos.pyThe script will prompt you to enter the folder path.
- Create a file named
run_processor.batwith this content:
@echo off
python process_videos.py %1
pause- Drag your video folder onto the
.batfile
my_videos/
βββ vacation.mp4
βββ tutorial.mp4
python process_videos.py "C:\my_videos"Result: Audio files are extracted
my_videos/
βββ vacation.mp4
βββ vacation.m4a β Extracted audio
βββ tutorial.mp4
βββ tutorial.m4a β Extracted audio
- Import
.m4afiles into Reaper (or your preferred DAW) - Edit the audio (mixing, effects, etc.)
- Export as WAV with the naming convention:
video_name-mix.wav
Recommended Reaper Export Settings:
- Format: WAV
- Sample Rate: 48000 Hz (match video)
- Bit Depth: 24-bit or 32-bit float
- Resample Mode: r8brain free (or Medium/Good)
my_videos/
βββ vacation.mp4
βββ vacation.m4a
βββ vacation-mix.wav β Your edited audio from Reaper
βββ tutorial.mp4
βββ tutorial.m4a
βββ tutorial-mix.wav β Your edited audio from Reaper
python process_videos.py "C:\my_videos"Result: Final videos are created
my_videos/
βββ vacation.mp4
βββ vacation.m4a
βββ vacation-mix.wav
βββ vacation-mix.mp4 β β Final video with edited audio!
βββ tutorial.mp4
βββ tutorial.m4a
βββ tutorial-mix.wav
βββ tutorial-mix.mp4 β β Final video with edited audio!
For each .mp4 file in the folder:
ffmpeg -i video_name.mp4 -vn -acodec copy video_name.m4a- Extracts audio without re-encoding
- Preserves original audio quality
- Creates
.m4afiles ready for DAW import
For each video_name-mix.wav found:
ffmpeg -i video_name.mp4 -i video_name-mix.wav -c:v copy -c:a aac -b:a 320k -map 0:v:0 -map 1:a:0 video_name-mix.mp4- Keeps original video stream (no re-encoding = no quality loss)
- Encodes audio to 320 kbps AAC (maximum quality)
- Creates social media-ready MP4 files
============================================================
FFMPEG VIDEO AUDIO PROCESSOR
============================================================
Folder: C:\Users\YourName\Videos\my_videos
Found 2 video file(s) to process
************************************************************
PROCESSING: vacation.mp4
************************************************************
[STEP 1/2] Extracting audio to: vacation.m4a
============================================================
STARTING: Extracting audio from vacation.mp4
============================================================
Command: ffmpeg -i vacation.mp4 -vn -acodec copy -y vacation.m4a
β SUCCESS: Extracting audio from vacation.mp4
β Audio extracted successfully: vacation.m4a
[STEP 2/2] Found edited audio: vacation-mix.wav
Creating new video: vacation-mix.mp4
============================================================
STARTING: Merging vacation-mix.wav with vacation.mp4
============================================================
β SUCCESS: Merging vacation-mix.wav with vacation.mp4
β Video created successfully: vacation-mix.mp4
============================================================
PROCESSING COMPLETE
============================================================
Audio files extracted: 2
Videos merged: 2
Errors: 0
============================================================
Important: Follow this naming pattern:
| Original Video | Extracted Audio | Edited Audio (from DAW) | Final Output |
|---|---|---|---|
video.mp4 |
video.m4a |
video-mix.wav |
video-mix.mp4 |
my_clip.mp4 |
my_clip.m4a |
my_clip-mix.wav |
my_clip-mix.mp4 |
The script automatically:
- Ignores files ending with
-mix.mp4(to avoid processing output files) - Looks for
-mix.wavfiles to determine which videos need audio replacement
- Preserves quality: Original video remains untouched
- Fast processing: Only audio is encoded
- No generation loss: Perfect for iterative editing
- 320 kbps AAC: Indistinguishable from lossless for most listeners
- Compatible: Works with Instagram, YouTube, TikTok
- Professional: Suitable for content creation
The output MP4 files with AAC audio are compatible with:
- β Instagram
- β YouTube
- β TikTok
- β Facebook
- β Twitter/X
- β Most video platforms
- Make sure FFmpeg is installed
- Check that
C:\ffmpeg\binis in your system PATH - Restart Command Prompt after adding to PATH
- Verify you're pointing to the correct folder
- Make sure video files have
.mp4extension - Check that files aren't named with
-mix.mp4ending
- Ensure your DAW project sample rate matches the video (usually 48000 Hz)
- Check that exported WAV length matches the original audio length
- FFmpeg might be waiting for confirmation to overwrite files
- The script uses
-yflag to avoid this, but check for error messages
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with FFmpeg
- Designed for workflow with Reaper DAW
For questions or support, please open an issue on GitHub.
Made with β€οΈ for content creators