ffmpeg

ffmpeg is a very fast video and audio converter that can also grab from a live audio/video source. It can also convert between arbitrary sample rates and resize videos on the fly with a high quality polyphase filter.

Examples:

Rotating videos

# To install on OSX
brew install ffmpeg

# ROTATING VIDEOS IN LADNSCAPE MODE is pretty straight forward

# Rotate a LANDSCAPE video counter clockwise -90 degrees (to the left)
ffmpeg -i input.mp4 -metadata:s:v:0 rotate="-90" -codec copy output.mp4

# Rotate a LANDSCAPE video clockwise +90 degrees (to the right)
ffmpeg -i input.mp4 -metadata:s:v:0 rotate="90" -codec copy output.mp4

# Rotate a LANDSCAPE video 180 degrees (make it upside down)
ffmpeg -i input.mp4 -metadata:s:v:0 rotate="180" -codec copy output.mp4


# ROTATING VIDEOS IN PORTRAIT MODE (The following might seem weird but there is a logic behind it! hint: a video that is in portrait mode already has a tag that says rotated 90 degrees

# Rotate a PORTRAIT video counter clockwise -90 degrees (to the left)
ffmpeg -i input.mp4 -metadata:s:v:0 rotate="0" -codec copy output.mp4

# Rotate a PORTRAIT video clockwise +90 degrees (to the right)
ffmpeg -i input.mp4 -metadata:s:v:0 rotate="180" -codec copy output.mp4

# Rotate a PORTRAIT video 180 degrees (make it upside down)
ffmpeg -i input.mp4 -metadata:s:v:0 rotate="-270" -codec copy output.mp4

# Rotate all the videos in current direcoty [assume that you have a script called rotate-video that takes a filename and an angle]
for filename in *.mp4; do echo "rotating $filename"; rotate-video $filename 180;  done

# chop a video
ffmpeg -i input.mp4 -ss 00:00:03 -t 00:01:06 output.mp4

# lower the resolution a bit
ffmpeg -i input.mp4 -vf "scale=640:360" output.mp4

# combine the two
ffmpeg -i input.mp4 -ss 00:01:08 -t 00:01:42 -vf "scale=640:360" output.mp4