Falcon1986-Online

Home of a med student who likes to manage websites and talk tech!

[HOW-TO] Fix AVI files within Ubuntu with quick command

with 8 comments

Ubuntu LogoOnce in a while you might download an AVI video file and, when you try to play it, are disappointed to see an error message stating that the video is corrupt so cannot be played. Free media players such as the popular cross-platform “plays everything” VLC media playerwill sometimes recognize the corrupt video and offer to fix it. While VLC does a very good job at fixing corrupt AVI files, the fix is not applied to the original video. Therefore, any subsequent attempts to play the corrupt AVI again through VLC will always result in this prompt being initially displayed. If you are running Linux (in this case I am using Ubuntu 10.04), there is an easy way to apply the fix permanently via a quick command.

Requirements

Obviously, this is geared for those running Ubuntu, so some flavour of Linux is involved. Additionally, you will need to have MEncoder installed. If you have already set up Ubuntu for multimedia playback, then there should be nothing to stop you from immediately jumping in to the fix. However, if MEncoder is not installed something has to be done about it. For multimedia playback I like to execute the following 2 commands. They will take care of installing VLC, MEncoder and a lot of codecs.

sudo aptitude install vlc mplayer
sudo aptitude install non-free-codecs libxine1-ffmpeg gxine mencoder mpeg2dec vorbis-tools id3v2 mpg321 mpg123 libflac++6 ffmpeg libmp4v2-0 totem-mozilla icedax tagtool easytag id3tool lame nautilus-script-audio-convert libmad0 libjpeg-progs libmpcdec3 libquicktime1 flac faac faad sox ffmpeg2theora libmpeg2-4 uudeview flac libmpeg3-1 mpeg3-utils mpegdemux liba52-dev

Instructions

  1. Launch a command terminal by going to Applications > Accessories > Terminal.
  2. Locate the folder containing the AVI file you want fixed. In my case it was located in the Videos directory, so I entered:
    cd Videos
  3. Once there, enter the following command. Modify the file names to match the file names you are using:
    mencoder -forceidx -oac copy -ovc copy corruptvideo.avi -o fixedvideo.avi
  4. Press ENTER and watch the magic take place! The entire process should not take more than a minute to complete.

Once complete, you can retry playing the video through your favourite media player to see if the file was fixed.

Alternative for Windows

If you are a Windows user, on the other hand, and prefer something with a graphical interface, give DivFix++ a try.

Written by falcon1986

10 September, 2010 at 8:37 PM

Posted in Linux

Tagged with , ,

8 Responses

Subscribe to comments with RSS.

  1. DivFix++ is nowadays also available on Linux and Mac environments

    Edwin Siebel

    18 July, 2011 at 2:46 PM

  2. Hi

    I got it done by adding:

    -ovc copy

    to the said command

    Khurram

    9 November, 2011 at 4:09 PM

  3. Thank you, buddy, saved my day! 😀 I recorded a video using my astrowebcam and… it is corrupted 😦 Using your method I repaired it! Note: You can use Mencoder under Windows, it is ported successfully (I checked – it works).

    Fliker09

    20 March, 2012 at 7:59 AM

  4. […] [HOW-TO] Fix AVI files within Ubuntu with quick command …Sep 10, 2010 … While VLC does a very good job at fixing corrupt AVI files, the fix is not applied to the original video. Therefore, any subsequent attempts to play … […]

  5. i recorded a video from webcam but before i save it my power shuts down 😦 and the file requires a codec but i am also unable to find any codec for the video because, it keeps giving me a message that file is corrupted or damaged. so, please if any body could tell me how to fix it?? kindly, mail me a software name or method on my mail bluedevil00@rocketmail.com.

    sam

    22 May, 2012 at 7:59 PM

    • And file is in avi format.. soo please help me out here

      sam

      22 May, 2012 at 8:00 PM


Leave a comment