CatMerge is a shell script that lets you merge video/audio files right from your file manager.
Ideal for action cams or drones that split recordings into 4-GB segments.
The script tries to merge losslessly using ffmpeg -c copy.
If that isn’t possible (e.g. variable bitrate), it asks to re-encode.
ffmpegyadorzenity(for dialogs; script still prints to terminal if neither is available)
Ubuntu/Debian:
sudo apt update
sudo apt install -y ffmpeg yad # or: zenityFedora:
sudo dnf install -y yad # or: zenity
# ffmpeg via RPM Fusion
sudo dnf install -y https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install -y ffmpeggit clone https://github.com/Pappmann/CatMerge.git
cd CatMerge
mkdir -p ~/.local/bin
cp "Merge Media Files" ~/.local/bin/catmerge
chmod +x ~/.local/bin/catmergeThe script is universal: it accepts Nautilus environment variables or
%Farguments from other file managers.
mkdir -p ~/.local/share/nautilus/scripts
ln -sf ~/.local/bin/catmerge ~/.local/share/nautilus/scripts/"Merge Media Files"
nautilus -qmkdir -p ~/.local/share/nemo/scripts
ln -sf ~/.local/bin/catmerge ~/.local/share/nemo/scripts/"Merge Media Files"
nemo -q || truemkdir -p ~/.config/caja/scripts
ln -sf ~/.local/bin/catmerge ~/.config/caja/scripts/"Merge Media Files"
caja -q || truemkdir -p ~/.local/share/kio/servicemenus
cat > ~/.local/share/kio/servicemenus/catmerge.desktop << 'EOF'
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin
MimeType=video/*;audio/*;
Actions=CatMerge;
Icon=media-tape
X-KDE-Submenu=CatMerge
[Desktop Action CatMerge]
Name=Merge Media Files (CatMerge)
Icon=media-tape
Exec=/bin/bash -lc '~/.local/bin/catmerge %F'
EOFmkdir -p ~/.local/share/file-manager/actions
cat > ~/.local/share/file-manager/actions/catmerge.desktop << 'EOF'
[Desktop Entry]
Type=Action
Name=Merge Media Files (CatMerge)
Icon=media-tape
Profiles=profile-zero;
[X-Action-Profile profile-zero]
MimeTypes=video/*;audio/*;
Exec=/bin/bash -lc '~/.local/bin/catmerge %F'
Name=Default profile
EOFCreate a Custom Action via GUI:
- Name:
Merge Media Files (CatMerge) - Command:
/bin/bash -lc '~/.local/bin/catmerge %F' - Appearance Conditions: enable for Audio Files and Video Files.
- Select the media segments (e.g.,
…_001.MP4,…_002.MP4, …). - Right-click → Scripts/Actions → Merge Media Files.
- If required, confirm re-encoding.
- Output is saved in the same folder (default name includes the source date).
You can also run CatMerge directly on the command line:
# Merge files in natural sort order
catmerge file1.mp4 file2.mp4 file3.mp4
# Or use shell globs (sorted automatically)
catmerge *.MP4
# Works with audio too
catmerge track1.mp3 track2.mp3Log output is written to /tmp/catmerge.log.
By default, the merged file inherits the modification timestamp of the first
source file. You can toggle this behavior by editing the
PRESERVE_SOURCE_TIMESTAMP switch near the top of the catmerge script (or the
Merge Media Files source file) and setting it to true or false.
CC0 – Public Domain
