Joins and compresses split GoPro video files using ffmpeg. GoPro cameras split long recordings into multiple chapters (e.g. GH010042, GH020042, GH030042) — this script automatically detects those sets, joins the chapters losslessly, then compresses the result to H.265/HEVC for dramatically smaller file sizes.
Features
- Automatically detects and groups GoPro chapter files by set number
- Supports GoPro naming conventions: GH (Hero 5–8), GX (Hero 9–11), GP (Hero 12+)
- Joins chapters without re-encoding (fast, no quality loss)
- Compresses to H.265/HEVC with configurable quality (CRF) and speed preset
- Outputs to a `compressed` subfolder, keeping originals safe
- Optional `-DeleteOriginals` flag to remove source files after verified compression
- `-WhatIf` flag to preview what would be processed
- Skips non-GoPro files with a clear message
Usage
Navigate to your video folder, then run the script
cd "D:\Footage\2024\20240715"
reduce-videos.ps1
Custom quality and speed (lower CRF = better quality, slower preset = smaller files)
reduce-videos.ps1 -CRF 20 -Preset medium
Preview what would happen
reduce-videos.ps1 -WhatIf
Delete originals after successful compression
reduce-videos.ps1 -DeleteOriginals
Parameters
| Parameter | Default | Description |
|—————–|————|——————-|
| `-CRF` | 23 | Quality (0–51, lower = better). Recommended: 18–28 |
| `-Preset` | slow | Encoding speed. Options: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow |
| `-OutputPrefix` | compressed_ | Prefix for output filenames |
| `-DeleteOriginals` | off | Remove source files after verified compression |
| `-WhatIf` | off | Preview without processing |
Requirements
- Windows with PowerShell 5.1 or later (included with Windows 10/11)
- ffmpeg — free, open-source video toolkit
Installing ffmpeg
- Open PowerShell and run: `winget install Gyan.FFmpeg`
- Restart any open terminal/PowerShell windows.
- Verify by running: `ffmpeg -version`
Alternatively, download manually from https://ffmpeg.org/download.html – grab the “essentials” build, extract it, and add the `bin` folder to your system PATH.
unning PowerShell Scripts
If you haven’t run PowerShell scripts before, you may need to allow it once. Open PowerShell as Administrator and run:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Then navigate to the folder containing the script and run it.
Adding the Script to Your PATH (Optional)
For convenience, you can add the folder containing the script to your system PATH so you can run it from any directory:
- Press Win + S and search for “Environment Variables”
- Click “Edit the system environment variables”
- Click Environment Variables at the bottom
- Under User variables, select Path and click Edit
- Click New and paste the full path to the folder where you saved the script (e.g. `C:\Scripts`)
- Click OK on all dialogs
- Restart any open terminal windows
You can now run `reduce-videos.ps1` from anywhere without navigating to the script’s folder first.
Free download — if you find it useful, consider supporting development