05F707AE0DD5B77E1C3EACC8C3384CA2 How to fix corrupt MP4 video?

How to fix corrupt MP4 video?

You know, as soon as I have 5 minutes, I try to make some little videos on Youtube. It still takes a little while, and unfortunately, sometimes I have the material that messes up.

How to fix corrupt MP4 video

I was doing a little screencast when suddenly, I have a USB hub that broke and the disc plugged into it, which I use to store my videos too. The OBS software I use to shoot crashed, and the video recording stopped.

And this is how I ended up with a corrupt MP4 video. Cannot play it even in VLC. So I investigated the problem and saw that there were tons of nice paid services or shareware out there to fix corrupt MP4 video. But none convinced me, and I was convinced at the time that there was better.

I first tried it with ffmpeg using the following command to make an (uncorrupted) copy of my corrupted video.

ffmpeg -i VideoCorrupted.mp4 -c copy Video.mp4

But all I got was the following error:

moov atom not found

VideoCorrupted.mp4: Invalid data found when processing input

I didn't know this stuff, so I looked for a definition:

Moov Atom contains all the information about the video file read by video players. Video encoders often automatically move metadata at the beginning of video files to make them accessible on the web.

It is, therefore, the metadata that is not present, but the video itself is there. Especially since my corrupted file weighs several Giga, so sure, there is something in this MP4. It only remained to find out how to access it.

And I found it!!! There is a software called Untrunc which can repair corrupt MP4, M4V, MOV, and 3GP. So I will tell you how to repair a corrupted video file.

So, first of all, you have to know that Untrunc is software for Linux. But that it is possible to run it in Docker, and that's what I'm going to explain to you today so that you will have a universal solution that will work on all OS capable of running Docker.

And all in 3 small steps! Magic magic!

Step 1 - Download and install Docker.

Go here and download Docker for your operating system. Then install it and launch it.

If you are on Ubuntu, here is the procedure:

sudo apt-get install curl apt-transport-https ca-certificates software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch = amd64] https://download.docker.com/linux/ubuntu $ (lsb_release -cs) stable"

sudo apt update

sudo apt install docker-ce

And to check that it is running:

sudo systemctl status docker

Step 2 - Download and install the image.

There are several Untrunc images on the Docker repository, and I chose the one from synctree because it is the most downloaded.

So to retrieve it, in a terminal or a command prompt, do:

docker pull synctree / untrunc

Step 3 - Start the repair.

You should know that to repair the corrupt MP4 video file, Untrunc needs 2 videos. Your corrupted video, of course, but also a perfectly readable reference video, produced with the same tool, under the same conditions, in order to be able to recompose the corrupted metadata.

So still in the terminal, enter the following command:

docker run -v / directory / of / videos: / files -it synctree / untrunc /files/VideoOK.mp4 /files/VideoCorrupted.mp4

Remember to replace "/ directory / of / videos" with the path to your videos. "/ Files" is a kind of alias that will then point to "/ directory / of / videos." This is why you will be able to specify the path to your videos using the alias like this "/files/VideoOK.mp4". I hope to be as clear as possible.

Validate and let it run! You should see a lot of things like this scrolling:

It may take longer or shorter, but in the end, you will have a file like VideoCorrupted.mp4_fixed.mp4 that will be created, and your video will be playable!

It is possible that the sound is out of sync, something that happens quite often. In this case, remember to readjust it with your favorite video editing software.

Post a Comment