Video Production Stack Exchange is a question and answer site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to prepare a collection of ~120 video clips to be played in VLC Player and projected on a low-res (1024x768) projector during a DIY electronic music event. The source clips are all super hi-res abstract visuals in .mov format, about 4GB each. They are of various aspect ratios. Some are 4:3, others are 16:9, others are 1:1 (square) etc.

I would like to crop / scale all of the clips to 1024x768 while maintaining their respective original aspect ratios. And, I would like to do so without letterboxing them and leaving black bars either at the top/bottom or left/right. Basically what I would like to do is to reduce them to the point where they entirely fill the 1024x768 screen, and no smaller. I believe that is essentially a "pan and scan" technique?

(It doesn't matter if part of the image is removed in the process - they're just spinning geometric shapes and such.)

Is there some way I can resize all ~120 videos in batch using a single FFMPEG command? Or, is there another tool for Windows or Linux that would work? I don't really care what output format - just something that VLC can play without getting choppy.

share|improve this question

If you had just 4:3 and 16:9 videos, I would suggest:

ffmpeg -i -filter:v 'scale=-1:768;crop=1024:ih' \
-c:v libx264 -crf 23 -preset veryfast output.mp4

That would scale a video to a height of 768, scaling the width to keep the aspect ratio; and then it crops the width to 1024, keeping the height at 768. However, the fact that you are using 1:1 videos as well complicates things: a 3000x3000 video would get scaled to 768x768, and then ffmpeg would try to crop it to 1024x768, which obviously wouldn't work, since crops can be no bigger than the input...

The only way I can think of getting this to work would be to crop all of the videos, which you stated wouldn't be a problem. This will crop the output width to be the same as the input height, and the output height to be 3/4 of the input height; and then it will scale the video down to a height of 768, keeping the aspect ratio with the width:

ffmpeg -i -filter:v 'crop=ih:3/4*ih,scale=-1:768' \
-c:v libx264 -crf 23 -preset veryfast output.mp4

This will only work if the original files have a height of 1024 or more. Note that x264 only accepts an even width or height, which can cause problems (but shouldn't in this case).

To convert every .mov in a directory, you can use a for loop:

for f in *.mov; \
do ffmpeg -i "$f" -filter:v 'crop=ih:3/4*ih,scale=-1:768' \
-c:v libx264 -crf 23 -preset veryfast "${f/%mov/mp4}"; \

To do so recursively, you can use find:

find . -type f -name *.mov -exec bash -c \
'ffmpeg -i "$0" -filter:v "crop=ih:3/4*ih,scale=-1:768" \
-c:v libx264 -crf 23 -preset veryfast "${0/%mov/mp4}"' {} \;

All of this will require a recent version of ffmpeg.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.