Cropping AVI files in FFMPEG

The syntax to crop AVI files in FFMPEG has changed recently from the previous syntax. The syntax for FFMPEG version 0.7.3 AVI cropping is as follows:

ffmpeg -i input.avi -vf crop=439:455:73:15 -vcodec mjpeg -qscale 2 output.avi

The assumptions made above were that you wanted your output video to be:
439 pixels wide
455 pixels high
trimming 73 pixels from the left
trimming 15 pixels from the top
of your input video, and that you wanted Motion JPEG output e.g. “-vcodec mjpeg“.
The “-qscale 1” makes low compression (best possible MJPEG quality). qscale can go from 1 to 31 in the current version of ffmpeg.

Obviously, change these pixel parameters to suit your particular video.

MATLAB Linux AVI playback “only uncompressed AVI movies can be read on UNIX” error

MATLAB on Linux claims to only playback uncompressed AVI files on “UNIX” systems.

However, MATLAB on Linux can’t even play all uncompressed AVI filed depending on your particular system configuration with gstreamer. The solution thus far, with MATLAB 2012a, seems to be using Motion JPEG in AVI videos.

Here’s a tentative solution for playing back video on Linux systems with MATLAB 2012a, that is, MATLAB “should” be able to playback “out.avi”

ffmpeg -i input.avi -vcodec mjpeg -qscale 1 out.avi

If you get an error about not having ffmpeg installed, on Ubuntu type in Terminal:

sudo apt-get install ffmpeg

Here is a video I transcoded the first second of using the above settings

Star collapse video from

(here is the actual command I used to truncate the video to one second and to heavily compress to reduce download size)
ffmpeg -i input.avi -vcodec mjpeg -t 1 -qscale 11 out.avi
(The sample AVI file is used under GNU LGPL from )