Untrunc is a command-line tool that restores truncated or damaged MP4, MOV, M4V, and 3GP video files by using a reference video from the same source as a template to recover the missing data.
The tool addresses the problem of corrupted video files that have lost their end sections or metadata, which renders them unplayable. It works by analyzing the structure and chunk patterns of a similar, undamaged video file and using that information to reconstruct the damaged file's internal structure. Success depends on having a reference video ideally from the same camera or device and some degree of luck with how the corruption occurred.
Untrunc suits anyone who has accidentally truncated a video file and possesses an intact copy from the same source. It is particularly useful for recovering footage from cameras like GoPro and Sony XAVC devices. The tool offers both command-line and GUI interfaces, with prebuilt Windows binaries available for users who prefer not to compile from source.
The project maintains active development with fixes for numerous bugs and expanding support for additional video formats and codecs. The tool includes an advanced logging system to help diagnose recovery issues and can adjust video duration to match audio tracks when needed. Building is straightforward across multiple platforms including Windows, macOS, and Linux, with Docker and Snapcraft options available for containerized deployment. The maintainer actively solicits issue reports with verbose output flags to improve the tool's recovery capabilities.