[HOW-TO] Fix AVI files within Ubuntu with quick command
Once 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.
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
- Launch a command terminal by going to Applications > Accessories > Terminal.
- Locate the folder containing the AVI file you want fixed. In my case it was located in the Videos directory, so I entered:
- 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
- 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.