Table of Content
    Video Repair

    How to Repair Corrupt Video Files using FFmpeg


    Table of Content

      “Can I repair corrupt MOV video files using FFmpeg that became corrupted after I changed settings during recording?”

      “How can I improve sound quality in my 2GB MP3 video file of Canon camcorder by FFmpeg? “

      Videos need editing or repair to improve quality and enhance the viewing experience. Sometimes, however good in quality, you may just want to edit, cut, sharpen, rotate, add sound or text over them. To do such tasks, there are a plethora of video editing tools. But unlike paid editing platforms, which may not let you do all the activities, FFmpeg is a complete software project for multimedia files. It has a vast suite of libraries and programs that lets you convert, edit, repair, and improve your video formats.

      FFmpeg multimedia framework has its distinct fan following too, owing to its multi-facet utilities.

      Recently, NASA used FFmpeg to combine the high-resolution images taken from the GOES-R series of Earth observation satellites to create a video. While some miles away, the game developer- Looking Glass Studios included FFmpeg video support in its latest Dark Mod Thief game version 2.06.

      Everyone from end users to developers uses open-source FFmpeg to create, convert, record, cut, stream, encode, transcode, mux, demux, and so much more to their videos.

      How does FFmpeg work?

      FFmpeg is a command-line tool that uses commands to convert audio or video formats.

      For example: To extract sound from a video and save it as MP3, you can use the command line:

      $ ffmpeg -i video1.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 audio3.mp3

      To increase video playback speed command line is:

      $ ffmpeg -i video.mpg -vf "setpts=0.5*PTS" highspeed.mpg

      It can also capture and encode in real-time from various sources such as a TV capture card. FFmpeg comes with a wide range of audio and video codec support. You can use it to fix your video-related issues of any file format on Linux, Mac OS X, Microsoft Windows, the Unix BSDs, and Solaris systems.

      What you can do with FFmpeg?

      • Decode, encode, transcode, mux, demux, stream, and filter multimedia files
      • Convert video to images and images to video
      • Scale, pad, crop, flip, rotate, blur, sharpen and de-noise video
      • Speed up or slow down audio and video
      • Let the computer read the text with the selected voice
      • Display and record input from your webcam
      • Record input from the microphone or send it to loudspeakers
      • Add static or dynamic text to the video
      • Add, edit, or delete file metadata
      • Preview modified input in 2, 3, or 4 windows
      • Include a logo or provide a Picture-in-Picture
      • Create sound with mathematical expressions
      • Resize video with a high-quality polyphase filter
      • Display input from 2 webcams in one window
      • Set the bitrate, frame rate, maximum file size, and related options
      • Encode subtitles directly to the video stream
      • Join various file formats, modify streams, and modify audio channels

      Can FFmpeg repair corrupt videos?

      Yes, it can. You can try to repair your video files using various command lines in FFmpeg. But this could be a little tricky for beginners. You should have knowledge of various command lines to perform different tasks in FFmpeg.

      Also, the success of repairing corrupt video files depends upon what issue you want to fix and how badly the file is damaged.

      How to Repair Corrupt Video Files like MOV, MP4, etc. using FFmpeg?

      To use FFmpeg you need to open a command prompt window and give specific command lines to fix corruption or inaccessible video problems.

      Step-by-step: How to use FFmpeg to fix corrupt video

      • Download and install FFmpeg on your computer.
      • Copy the corrupt video file from a source location to the desktop
      • Open Command Prompt using Win+R and type cmd in the box
      • In the command prompt window type in cd Desktop and press Enter
      How to Repair Corrupt Video Files like MOV, MP4 etc. using FFmpeg
      • Enter the command line. For example, to convert an MP4 video called ‘Party’ into an AVI file called ‘Birthday’, type in ffmpeg -i Party.mp4 Birthday.avi

      Note: Keep your file name exactly the same including the upper and lower case in the command line.

      Repair Corrupt Video Files like MOV, MP4 etc. using FFmpeg
      • Press Enter

      Once the process finishes, you can see the new video file on the Desktop with the file name that you entered (here as Birthday.avi)

      Similarly, you can use different command lines for various actions like below:

      1. To check for corruption in the input.ts stream video file and save the errors in log file:

      ffmpeg –v error –i corrupted_input.ts -f null - &> corruptions.log

      2. To fix the corrupt video file use:

      ffmpeg –i corrupted_input.ts –map –ignore_unknown/-copy_unknown –c copy fixed.ts

      3. If it’s a corrupt MP4 video:

      ffmpeg -i input.mp4 -c copy output.mp4

      4. To fix a WMV video not playing and showing a message video too long:

      In FFmpeg, first convert the video to still images and then still images back to video.

      First, extract all the frames into JPEG images using the command line:

      .\ffmpeg.exe -i ‘.\Video 36.wmv’ -an -f image2 filename%03d.jpg

      Note: Remember the number of images created (say for example 99987 images).

      Then, extract the audio using:

      .\ffmpeg.exe -i ‘.\Video 36.wmv’ audio.mp3

      Find the exact duration of the audio by using the command:

      .\ffprobe.exe -i .\audio.mp3 -show_entries format=duration -v quiet -print_format json

      You would output something as:

      {    "format": { "duration": "4325.56210"  }}

      Now calculate the frame rate of the output video to match the audio and video by diving the number of images formed by the audio duration:

      Here 99987 by 4325.56210 = 23.1153. This is the frame rate for your output video. It is necessary to use the exact number.

      Next, use the command line and press Enter:

      .\ffmpeg.exe -framerate 23.1153-f image2 -i .\filename%3d.jpg -codec copy ouput_noaudio.mkv

      Now, use the command line to mix the audio and video to get the final perfectly playing video:

      .\ffmpeg.exe –i .\output_noaudio.mkv –i .\audio.mp3 –c copy –map 0:v:0 –map 1:a:0 output.mkv

      Other easier programs to repair corrupt videos

      There are other programs such as video repair tools like Stellar Repair for Video; noise reduction video plugins like Neat Video or Red Giant Magic Bullet Denoiser; video editing software like Adobe Premiere Pro, Final Cut Pro X, or Lightworks that can be used to reduce noise and improve video quality.

      However, a dedicated video repair tool for video corruption is always a better choice. They can fix even severely corrupt MP4, MOV, AVI, MKV, and all other important video file formats that are not playable or show errors in loading.

      The free demo version of the software is good enough for evaluating whether a video corruption issue can be resolved.

      Download for Windows Download for Mac

      How to Repair Corrupt Videos Using Video Repair Software?

      Are you searching for software to repair broken video files? Stellar Repair for Video fixes almost all types of video corruptions that occur during editing, shooting, converting to a different format, or the transfer of videos, etc. It repairs corruption in frames, sound sections, headers, etc. You can play your videos that turned grainy, choppy, jerky, broken, frozen, out of sync, etc.

      Even the severely corrupt video files that are not fixed by FFmpeg or other editing/repair tools can be made playable using Stellar Repair for Video.

      The software can also repair video files created through the FFmpeg program. Moreover, you do not need to fret over the repair process. The advanced algorithms of the software easily fix any damage in the video files.

      It supports the repair of AVI, ASF, WMV, MKV, FLV, DIVX, WEBM, MJPEG, MPEG, AVCHD, MTS, MOV, MP4, M4V, 3G2, 3GP, and F4V video files.

      Wrapping up

      Thus by the above-mentioned methods, you can repair corrupt video files using FFmpeg using its command lines. However, for severely corrupt video files, a secure video repair tool Stellar Repair for Video is recommended. Unlike FFmpeg, the software works in all kinds of video corruption without you putting in any effort to repair the distorted multimedia file.

      Was this article helpful?

      No NO

      About The Author

      Sumona Chatterjee linkdin

      Sumona is a tech blogger, avid photographer, & technogeek with vast experience in writing about media file recovery tips and tutorials. She has over 10 years of experience in media file recovery/media file repair technology. She is passionate about Photography, Creative Designing, Music, and Exploring lesser-known destinations.

      22 comments

        1. Hola Carola
          Si desea utilizar FFmpeg en MAC por lo que hay maneras de instalarlo que creo que se puede encontrar. Después de la instalación, puede ejecutar la herramienta y siga las instrucciones mencionadas en este artículo para reparar vídeos corruptos utilizando FFmpeg.
          ¡Espero que te ayude!

      1. I got a corruption when saving mp4 video file because my disk is full. So my video is not completed. I use some software to view the file’s contains and see that: Size in mdat header is set to 0x00000000; and no moov chunk at the end of file. Whether I can use your software or any method to fix and repair my file? Thanks in advance!

        1. Hi Pham, you can try our software demo version if the demo version show the preview of your file. It’s definately repaired your video file. Thanks!

      2. Hi, can FFmpeg fix an mp4 file that has got an invalid timestamp error. And if not then is there any other program that can, as I have got an mp4 file which cannot be converted properly because of this problem?

        Thank you…

        1. Hi Leslie, You can use our software which may help to fix this issue of mp4 video using ffmpeg with timestamps. For converting the MP4 file, you can try Stellar Converter for Audio Video, which easily converts any video file to a supported video format. Thanks!

      3. Someone necessarily lends a hand to make critically posts I’d state.
        That is the very first time I frequented your website page and up to now?
        I amazed with the research you made to create this particular submit incredibly. Wonderful job!

      4. hello i am santosh
        I have 3.56 GB mp4 file ,during transfer from my mobile to PC ,but it cant play ,i try so many time using different media player still no solution .please if any have solution ?

        1. Hi Santosh, during transfer file from mobile to PC there is the chance file may be corrupted. I suggest you can try our software demo version and see the preview of your repaired file. Thanks!

      5. This software help to get fix the issue of my MOV video using ffmpeg with Meta data, timestamps or container info. And it’s very fast, usually faster than play speed. Thanks!

      6. Hi, I try this software for repairing our video files but its showing message for “add a reference” with the same device. Is it possible to repair a video without a reference?

      7. I fix this issues that I suppose stream and key frames related with ffmeg. This software worked like a charm for .avi files. Thank you!

      8. Awesome Post! I had issue with MP4 files atom not found input.mp4 it show an error Invalid data when processing. I try ffmpeg from the command line. Its work for me. Thanks!

      Leave a comment

      Your email address will not be published. Required fields are marked *

      Image Captcha
      Refresh Image Captcha

      Enter Captcha Here :

      Related Posts

      WHY STELLAR® IS GLOBAL LEADER

      Why Choose Stellar?

      • 0M+

        Customers

      • 0+

        Years of Excellence

      • 0+

        R&D Engineers

      • 0+

        Countries

      • 0+

        PARTNERS

      • 0+

        Awards Received