Skip to main content
Fix target of CD after code fetch & clarify the choice of options
Source Link
sparrowt
  • 2.5k
  • 1
  • 24
  • 23

It is possible to repair the broken mp4 or m4v file using Untrunc.

For this method you need another video file from the same device which isn't broken.

How to install untrunc

For compilation you need a Linux installation (ideally Ubuntu) and basic ability to use a command line. You can also skip this part and run untrunc via Docker (see the answer below), if you have that.

This is what to do:

  1. Install some pre-requisite libraries with this command:

sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev

  1. Clone, or download & unzip,Get the source code for Untrunc from the GitHub repo (choose one method):

git clone https://github.com/ponchio/untrunc.git or wget https://github.com/ponchio/untrunc/archive/master.zip && unzip master.zip -d untrunc

  1. Enter the source code directory:

cd untrunc

  • wget https://github.com/ponchio/untrunc/archive/master.zip && unzip master.zip && cd untrunc-master
  • or git clone https://github.com/ponchio/untrunc.git && cd untrunc
  1. Compile the source code using this command (all one line):

g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil

(you can try skipping this step and using the ready-provided executable, but it didn't work for me)

  1. Then you can actually fix the video. You need both the broken video & an example working video.

How to fix the video

Find another working video, ideally from the same camera and preferably at least as long as the broken one; also the same resolution if possible (I believe this may help though is not essential).

Run this command in the folder where you have unzipped and compiled Untrunc but replace the /path/to/... bits with your 2 video files:

./untrunc /path/to/working-video.m4v /path/to/broken-video.m4v

Then it should churn away and hopefully produce a playable file called broken-video_fixed.m4v

That's it you're done!

VLC Media Player should now be able to play the file. However it may be reporting the wrong length information (Untrunc tries to guess/work this out, but doesn't always get it right). To fix this try re-encoding the video through another program.

[Thanks to slhck's comment for the suggestion to try Untrunc.]

[Many thanks to Federico Ponchio for coding Untrunc in the first place, to solve this exact problem.]

It is possible to repair the broken mp4 or m4v file using Untrunc.

For this method you need another video file from the same device which isn't broken.

How to install untrunc

For compilation you need a Linux installation (ideally Ubuntu) and basic ability to use a command line. You can also skip this part and run untrunc via Docker (see the answer below), if you have that.

This is what to do:

  1. Install some pre-requisite libraries with this command:

sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev

  1. Clone, or download & unzip, the source code for Untrunc from the GitHub repo:

git clone https://github.com/ponchio/untrunc.git or wget https://github.com/ponchio/untrunc/archive/master.zip && unzip master.zip -d untrunc

  1. Enter the source code directory:

cd untrunc

  1. Compile the source code using this command (all one line):

g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil

(you can try skipping this step and using the ready-provided executable, but it didn't work for me)

  1. Then you can actually fix the video. You need both the broken video & an example working video.

How to fix the video

Find another working video, ideally from the same camera and preferably at least as long as the broken one; also the same resolution if possible (I believe this may help though is not essential).

Run this command in the folder where you have unzipped and compiled Untrunc but replace the /path/to/... bits with your 2 video files:

./untrunc /path/to/working-video.m4v /path/to/broken-video.m4v

Then it should churn away and hopefully produce a playable file called broken-video_fixed.m4v

That's it you're done!

VLC Media Player should now be able to play the file. However it may be reporting the wrong length information (Untrunc tries to guess/work this out, but doesn't always get it right). To fix this try re-encoding the video through another program.

[Thanks to slhck's comment for the suggestion to try Untrunc.]

[Many thanks to Federico Ponchio for coding Untrunc in the first place, to solve this exact problem.]

It is possible to repair the broken mp4 or m4v file using Untrunc.

For this method you need another video file from the same device which isn't broken.

How to install untrunc

For compilation you need a Linux installation (ideally Ubuntu) and basic ability to use a command line. You can also skip this part and run untrunc via Docker (see the answer below), if you have that.

This is what to do:

  1. Install some pre-requisite libraries with this command:

sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev

  1. Get the source code for Untrunc from the GitHub repo (choose one method):
  • wget https://github.com/ponchio/untrunc/archive/master.zip && unzip master.zip && cd untrunc-master
  • or git clone https://github.com/ponchio/untrunc.git && cd untrunc
  1. Compile the source code using this command (all one line):

g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil

(you can try skipping this step and using the ready-provided executable, but it didn't work for me)

  1. Then you can actually fix the video. You need both the broken video & an example working video.

How to fix the video

Find another working video, ideally from the same camera and preferably at least as long as the broken one; also the same resolution if possible (I believe this may help though is not essential).

Run this command in the folder where you have unzipped and compiled Untrunc but replace the /path/to/... bits with your 2 video files:

./untrunc /path/to/working-video.m4v /path/to/broken-video.m4v

Then it should churn away and hopefully produce a playable file called broken-video_fixed.m4v

That's it you're done!

VLC Media Player should now be able to play the file. However it may be reporting the wrong length information (Untrunc tries to guess/work this out, but doesn't always get it right). To fix this try re-encoding the video through another program.

[Thanks to slhck's comment for the suggestion to try Untrunc.]

[Many thanks to Federico Ponchio for coding Untrunc in the first place, to solve this exact problem.]

Link directly to GitHub; suggest cloning repo; minor improvements
Source Link
sparrowt
  • 2.5k
  • 1
  • 24
  • 23

It is possible to repair the broken mp4 or m4v file using UntruncUntrunc.

For this method you need another video file from the same device which isn't broken.

How to install untrunc

For compilation you need a Linux installation (ideally Ubuntu) and basic ability to use a command line. You can also skip this part and run untrunc via Docker (see the answer below), if you have that.

This is what to do:

  1. Install some pre-requisite libraries with this command:

sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev

  1. DownloadClone, or download & unzip, the source code for Untrunc from the githubGitHub repo:

git clone https://github.com/ponchio/untrunc.git or wget https://github.com/ponchio/untrunc/archive/master.zip

  1. Unzip the source code:

&& unzip master.zip -d untrunc

  1. Go intoEnter the source code directory where it's been unzipped:

cd untrunc-master

  1. Compile the source code using this command (all one line):

g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil

(you can try skipping this step and using the ready-provided executable, but it didn't work for me)

  1. Then you can actually fix the video. You need both the broken video and& an example working video.

How to fix the video

Ideally theFind another working video should be, ideally from the same camera & have the same resolution (mine was but it might work without). Also if it isand preferably at least as long as the broken one (preferably roughlyone; also the same) resolution if possible (I believe this may help though is not essential).

Run this command in the folder where you have unzipped and compiled Untrunc but replace the /path/to/... bits with your 2 video files:

./untrunc /path/to/working-video.m4v /path/to/broken-video.m4v

Then it should churn away and hopefully produce a playable file called broken-video_fixed.m4v

That's it you're done!

VLC Media Player should now be able to play the file. However it may be reporting the wrong length information (Untrunc tries to guess/work this out, but doesn't always get it right). To fix this try re-encoding the video through another program.

[Thanks to slhck's comment for the suggestion to try Untrunc.]

[Many thanks to Federico Ponchio for coding Untrunc in the first place, to solve this exact problem.]

It is possible to repair the broken mp4 or m4v file using Untrunc.

For this method you need another video file from the same device which isn't broken.

How to install untrunc

For compilation you need a Linux installation (ideally Ubuntu) and basic ability to use a command line. You can also skip this part and run untrunc via Docker (see the answer below), if you have that.

This is what to do:

  1. Install some pre-requisite libraries with this command:

sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev

  1. Download the source code for Untrunc from the github repo:

wget https://github.com/ponchio/untrunc/archive/master.zip

  1. Unzip the source code:

unzip master.zip

  1. Go into the directory where it's been unzipped:

cd untrunc-master

  1. Compile the source code using this command (all one line):

g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil

(you can try skipping this step and using the ready-provided executable, but it didn't work for me)

  1. Then you can actually fix the video. You need both the broken video and an example working video.

How to fix the video

Ideally the video should be from the same camera & have the same resolution (mine was but it might work without). Also if it is at least as long as the broken one (preferably roughly the same) this may help.

Run this command in the folder where you have unzipped and compiled Untrunc but replace the /path/to/... bits with your 2 video files:

./untrunc /path/to/working-video.m4v /path/to/broken-video.m4v

Then it should churn away and hopefully produce a playable file called broken-video_fixed.m4v

That's it you're done!

VLC Media Player should now be able to play the file. However it may be reporting the wrong length information (Untrunc tries to guess/work this out, but doesn't always get it right). To fix this try re-encoding the video through another program.

[Thanks to slhck's comment for the suggestion to try Untrunc.]

[Many thanks to Federico Ponchio for coding Untrunc in the first place, to solve this exact problem.]

It is possible to repair the broken mp4 or m4v file using Untrunc.

For this method you need another video file from the same device which isn't broken.

How to install untrunc

For compilation you need a Linux installation (ideally Ubuntu) and basic ability to use a command line. You can also skip this part and run untrunc via Docker (see the answer below), if you have that.

This is what to do:

  1. Install some pre-requisite libraries with this command:

sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev

  1. Clone, or download & unzip, the source code for Untrunc from the GitHub repo:

git clone https://github.com/ponchio/untrunc.git or wget https://github.com/ponchio/untrunc/archive/master.zip && unzip master.zip -d untrunc

  1. Enter the source code directory:

cd untrunc

  1. Compile the source code using this command (all one line):

g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil

(you can try skipping this step and using the ready-provided executable, but it didn't work for me)

  1. Then you can actually fix the video. You need both the broken video & an example working video.

How to fix the video

Find another working video, ideally from the same camera and preferably at least as long as the broken one; also the same resolution if possible (I believe this may help though is not essential).

Run this command in the folder where you have unzipped and compiled Untrunc but replace the /path/to/... bits with your 2 video files:

./untrunc /path/to/working-video.m4v /path/to/broken-video.m4v

Then it should churn away and hopefully produce a playable file called broken-video_fixed.m4v

That's it you're done!

VLC Media Player should now be able to play the file. However it may be reporting the wrong length information (Untrunc tries to guess/work this out, but doesn't always get it right). To fix this try re-encoding the video through another program.

[Thanks to slhck's comment for the suggestion to try Untrunc.]

[Many thanks to Federico Ponchio for coding Untrunc in the first place, to solve this exact problem.]

add some info on Docker usage and structure answer
Source Link
slhck
  • 230.1k
  • 71
  • 621
  • 603

It is possible to repair the broken mp4 or m4v file using [Untrunc][1]Untrunc.

For this method you need: another video file from the same device which isn't broken.

  • another video file which isn't broken

  • a linux installation (I used Ubuntu 12.04) and basic ability to use a command line.

How to install untrunc

For compilation you need a Linux installation (ideally Ubuntu) and basic ability to use a command line. You can also skip this part and run untrunc via Docker (see the answer below), if you have that.

This is what to do:

  1. Install some pre-requisite libraries with this command:

sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev

  1. Download the source code for Untrunc from the github repo:

wget https://github.com/ponchio/untrunc/archive/master.zip

  1. Unzip the source code:

unzip master.zip

  1. Go into the directory where it's been unzipped:

cd untrunc-master

  1. Compile the source code using this command (all one line):

g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil

(you can try skipping this step and using the ready-provided executable, but it didn't work for me)

  1. Then you can actually fix the video. You need both the broken video and an example working video.

How to fix the video

Ideally the video should be from the same camera & have the same resolution (mine was but it might work without). Also if it is at least as long as the broken one (preferably roughly the same) this may help.

Run this command in the folder where you have unzipped and compiled Untrunc but replace the /path/to/... bits with your 2 video files:

./untrunc /path/to/working-video.m4v /path/to/broken-video.m4v. bits with your 2 video files:

./untrunc /path/to/working-video.m4v /path/to/broken-video.m4v

Then it should churn away and hopefully produce a playable file called broken-video_fixed.m4v

That's it you're done!

VLC Media Player should now be able to play the file. However it may be reporting the wrong length information (Untrunc tries to guess/work this out, but doesn't always get it right). To fix this try re-encoding the video through another program.

[Thanks to slhck's comment for the suggestion to try Untrunc.]

[Many thanks to Federico Ponchio for coding Untrunc in the first place, to solve this exact problem.] [1]: http://vcg.isti.cnr.it/~ponchio/untrunc.php

It is possible to repair the broken mp4 or m4v file using [Untrunc][1].

For this method you need:

  • another video file which isn't broken

  • a linux installation (I used Ubuntu 12.04) and basic ability to use a command line.

This is what to do:

  1. Install some pre-requisite libraries with this command:

sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev

  1. Download the source code for Untrunc from the github repo:

wget https://github.com/ponchio/untrunc/archive/master.zip

  1. Unzip the source code:

unzip master.zip

  1. Go into the directory where it's been unzipped:

cd untrunc-master

  1. Compile the source code using this command (all one line):

g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil

(you can try skipping this step and using the ready-provided executable, but it didn't work for me)

  1. Then you can actually fix the video. You need both the broken video and an example working video.

Ideally the video should be from the same camera & have the same resolution (mine was but it might work without). Also if it is at least as long as the broken one (preferably roughly the same) this may help.

Run this command in the folder where you have unzipped and compiled Untrunc but replace the /path/to/... bits with your 2 video files:

./untrunc /path/to/working-video.m4v /path/to/broken-video.m4v

Then it should churn away and hopefully produce a playable file called broken-video_fixed.m4v

That's it you're done!

VLC Media Player should now be able to play the file. However it may be reporting the wrong length information (Untrunc tries to guess/work this out, but doesn't always get it right). To fix this try re-encoding the video through another program.

[Thanks to slhck's comment for the suggestion to try Untrunc.]

[Many thanks to Federico Ponchio for coding Untrunc in the first place, to solve this exact problem.] [1]: http://vcg.isti.cnr.it/~ponchio/untrunc.php

It is possible to repair the broken mp4 or m4v file using Untrunc.

For this method you need another video file from the same device which isn't broken.

How to install untrunc

For compilation you need a Linux installation (ideally Ubuntu) and basic ability to use a command line. You can also skip this part and run untrunc via Docker (see the answer below), if you have that.

This is what to do:

  1. Install some pre-requisite libraries with this command:

sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev

  1. Download the source code for Untrunc from the github repo:

wget https://github.com/ponchio/untrunc/archive/master.zip

  1. Unzip the source code:

unzip master.zip

  1. Go into the directory where it's been unzipped:

cd untrunc-master

  1. Compile the source code using this command (all one line):

g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil

(you can try skipping this step and using the ready-provided executable, but it didn't work for me)

  1. Then you can actually fix the video. You need both the broken video and an example working video.

How to fix the video

Ideally the video should be from the same camera & have the same resolution (mine was but it might work without). Also if it is at least as long as the broken one (preferably roughly the same) this may help.

Run this command in the folder where you have unzipped and compiled Untrunc but replace the /path/to/... bits with your 2 video files:

./untrunc /path/to/working-video.m4v /path/to/broken-video.m4v

Then it should churn away and hopefully produce a playable file called broken-video_fixed.m4v

That's it you're done!

VLC Media Player should now be able to play the file. However it may be reporting the wrong length information (Untrunc tries to guess/work this out, but doesn't always get it right). To fix this try re-encoding the video through another program.

[Thanks to slhck's comment for the suggestion to try Untrunc.]

[Many thanks to Federico Ponchio for coding Untrunc in the first place, to solve this exact problem.]

Update the source code link
Source Link
sparrowt
  • 2.5k
  • 1
  • 24
  • 23
Loading
Clarified about Untrunc guessing the video length.
Source Link
sparrowt
  • 2.5k
  • 1
  • 24
  • 23
Loading
Source Link
sparrowt
  • 2.5k
  • 1
  • 24
  • 23
Loading