Post

Repairing Corrupt MP4 Videos: Untrunc and the New AUR Package

🇬🇧 Repairing Corrupt MP4 Videos: Untrunc and the New AUR Package

Repairing Corrupt MP4 Videos: Untrunc and the New AUR Package

One of the most frustrating things that can happen during video production or daily recordings is encountering a “truncated” (unfinished/corrupt) video file. This issue, which can occur due to a camera battery dying, a sudden shutdown, or a file system error during recording, prevents the video’s header information from being written, making it unplayable.

This is exactly where Untrunc comes into play.

What is Untrunc?

Untrunc is a popular open-source tool originally developed by Federico Ponchio (ponchio/untrunc) to repair damaged video files. Its core principle involves repairing a broken video using a healthy reference video recorded with the same camera or settings. It restores the header sections of the corrupt file by copying the metadata structure from the healthy video, making it playable again.

The version we are focusing on, and for which we’ve provided an AUR package (fr0stb1rd/untrunc), is an improved fork that adds several performance optimizations and extra features.

Some advantages offered by this fork:

  • Works 10 times faster than the original version.
  • Low memory usage.
  • Support for files over 2GB.
  • Advanced logging system.
  • Support for GoPro and Sony XAVC formats.

Now Easier for Arch Linux Users!

As of today, we have made the installation process for this powerful tool much more effortless for Arch Linux users. Thanks to the AUR binary package I’ve released, you no longer need to deal with compiling from source code.

You can install it with a single command using one of the popular AUR helpers (paru or yay):

1
2
3
paru -S untrunc-anthwlock-bin
# or
yay -S untrunc-anthwlock-bin

This package comes with FFmpeg statically bundled inside, so it works without installing any additional dependencies on your system.

Manual Installation

If you are not using a helper, let’s install it manually:

1
2
3
git clone https://aur.archlinux.org/untrunc-anthwlock-bin.git
cd untrunc-anthwlock-bin
makepkg -si

How to Recover Video?

After installation, all you need to do is run the following command:

1
untrunc /path/healthy-video.mp4 /path/corrupt-video.mp4

In a few seconds, your repaired file named corrupt-video_fixed.mp4 will be ready.

What’s Changed? (v1.0.0 Updates)

With the latest updates we’ve made across the repo:

  1. Cross-Platform Support: We’ve built an automatic binary creation system via GitHub Actions for Linux (amd64, arm64, armv7, i386) and macOS (Intel, Apple Silicon).
  2. Documentation: We’ve renewed the README file to include all supported architectures and AUR installation instructions.
  3. Clean History: We’ve given the repo commit history a professional structure suitable for the PR process.

If you have a broken video, give Untrunc a shot.

Project homepage: fr0stb1rd/untrunc AUR page: untrunc-anthwlock-bin

This post is licensed under CC BY 4.0 by the author.