How to resample video

I don’t take video, and I don’t know anything about video.  However, every once in a while I’ve had friends take video that I’ve actually wanted to keep.  File sizes can be huge so resampling is important.  I know from watching movies that 90 minutes can be good quality at 700MB file size.  Yet, if you shoot video on an iphone, you’ll reach 700MB in less than six minutes!!  What gives?

The preferred tool for video resampling seems to be avconc  The avconv options are endless (a 6000 line man page, of which I understand almost nothing) and difficult to understand for video non-experts.  There are a few important things to know.

  • Valid video seems to only exist at certain aspect ratios or actually, I believe, certain frame sizes unlike photos.  You can’t simply crop a video to whatever frame size you want like you can with photos.
  • Compression is much more complicated than with photos — no surprise here.

avconv has a couple options that I found quite useful.

    • -t seconds  This will restrict your output to the number of seconds you’ve specified.  This is quite useful since avconv take a long time to run.  You can check your results before processing your entire file.
    • -crf number  I think of this as a compression factor.  As this number goes up, file size goes down and quality goes down.  I ended up settling on 32 which worked out to about 9MB/min of video.  That works out to ~800MB for 90 minutes, not far off what the experts do!

So in the end these worked well for me:

avconv -i 20160831_205939.mp4 -vf "yadif=1,scale=-1:720,transpose=1" -codec:v libx264 -crf 32 -preset slow -codec:a copy 20160831_205939_resampled_crf32.mp4
avconv -i 20160831_235629.mp4 -s 1280x720 -codec:v libx264 -crf 32 -preset slow -codec:a copy 20160831_235629_resampled_crf32.mp4

Note that difference here is whether your original video is rotated or not.  The first video was taken vertically, the second horizontally.  Good luck.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.