Guides and Reviews‎ > ‎Software‎ > ‎

How to Rotate AVI files Nearly Losslessly


Background:
Some AVI files are Motion JPEGs, which are simply a series of JPEG images that are strung together over an audio track.  These pictures and audio are contained inside the .avi "container." 

Problem:
I sometimes forget and hold my Fuji F31fd point and shoot camera in portrait orientation when recording movies, which makes them appear rotated when viewed on a computer.  I searched for a long time to find a free program that would rotate the Motion JPG .avi files without re-encoding, which is very lossy. 

Solution:
AVIdemux is a nice free program that appears to unpack your .avi container, rotate the JPEGs, and re-pack the container, all without re-encoding.  It is nearly lossess.  It is not totally lossless because, by nature, rotating .jpg pictures is a little bit lossy, but not noticeable if the pics are only rotated only once.  Other programs I tried would introduce unacceptably nasty blocky artifacts into the rotated video.  I'm sure that you will not notice the difference when using the method below.
  1. Download a free program called AVIdemux
  2. Open AVIdemux.
  3. Open your video in AVIdemux either by File>Open, or by dragging the video onto the AVIdemux interface.
  4. Click the big blue "i" button to see what codec your video was encoded with. (e.g. my .avi files show as MJPG)
  5. Under "Video" on the left, select the same codec/format as in step 4 (e.g. M-JPEG matches MJPG).
  6. Click Video>Filters.  Select Transform, then double-click Rotate, and select the correct rotation (either 90degrees or 270 degrees to rotate from portrait to landscape), then click OK, then click Preview to ensure you got it right.  Click OK, and Close.
  7. Save Video either with the big icon, or via File>Save>Save Video.  Give the file a name and the extension matching the format/codec you chose in step 5 (e.g. M-JPEG=.avi extension).
  8. You have now successfully rotated your .avi file nearly losslessly.
Also, see here how you can use AVIdemux to extract the audio track from your video as a stand-alone audio file.