Skip to content

Installing on macOS

sk9c00 edited this page Sep 3, 2024 · 4 revisions

Docker Method

  1. Get Docker Desktop.
    1. Via brew:
      • brew install --cask docker
  2. Start Docker Desktop. Make sure bottom left green bar says Engine Running.
  3. Clone git repo.
    1. Via direct zip download.
      1. Click download.
      2. Unzip.
    2. Via git.
  4. Open Terminal.
  5. cd into folder.
    1. Type cd . Note the space.
    2. Drag respective untrunc-master folder into terminal window.
    3. Press enter.
  6. docker build --build-arg FF_VER=3.3.9 -t untrunc . (specifies specific FFMPEG version) or docker build -t untrunc .. Please note the space and full stop.
  7. (OPTIONAL) docker image prune --filter label=stage=intermediate -f. Cleanup. Didn't do much for me.
  8. docker run untrunc. Check untrunc runs. You should see:
Usage: untrunc [options] <ok.mp4> [corrupt.mp4]
...
  1. docker run -v ~/Movies/:/mnt untrunc /mnt/ok.mp4 /mnt/broken.mp4.
  2. Done.

Command Explanation

docker run -v ~/Movies/:/mnt untrunc /mnt/ok.mp4 /mnt/broken.mp4

docker

The base command for the Docker CLI. For further info see here.

run

Create and run a new container from an image. For further info see here.

-v

Bind mount a volume. For further info see here.

~/Movies/:/mnt

Mounts "user home directory"/Movies, usually /Users/[username]/Movies, to /mnt of docker container.

untrunc

The base command for untrunc CLI.

Usage: untrunc [options] <ok.mp4> [corrupt.mp4]

general options:
-V  - version
-n  - no interactive

repair options:
-s  - step through unknown sequences
-st <step_size> - used with '-s'
-sv - stretches video to match audio duration (beta)
-dw - don't write _fixed.mp4
-dr - dump repaired tracks, implies '-dw'
-k  - keep unknown sequences
-sm  - search mdat, even if no mp4-structure found
-dcc  - dont check if chunks are inside mdat
-dyn  - use dynamic stats
-range <A:B>  - raw data range
-dst <dir|file>  - set destination
-skip  - skip existing
-noctts  - dont restore ctts
-mp <bytes>  - set max partsize

analyze options:
-a  - analyze
-i[t|a|s] - info [tracks|atoms|stats]
-d  - dump samples
-f  - find all atoms and check their lenghts
-lsm - find all mdat,moov atoms
-m <offset> - match/analyze file offset
untrunc <ok.mp4> <ok.mp4> - report wrong values

other options:
-ms  - make streamable
-sh  - shorten
-u <mdat-file> <moov-file> - unite fragments

logging options:
-q  - quiet, only errors
-w  - show hidden warnings
-v  - verbose
-vv - more verbose
-do - don't omit potential noise

/mnt/ok.mp4

A working sample mp4 file. Preferably from the same/similar camera source etc. This is equivalent to ~/Movies/ok.mp4 on your computer.

/mnt/broken.mp4

The broken mp4 file. Errors like ffmpeg: "moov atom not found" should be fixable. Usually what's left in the file should be salvageable. This is equivalent to ~/Movies/broken.mp4 on your computer.