Skip to content

Instantly share code, notes, and snippets.

@vasile
Created April 28, 2016 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vasile/35c11a423ff9fd261829fb784f5550a4 to your computer and use it in GitHub Desktop.
Save vasile/35c11a423ff9fd261829fb784f5550a4 to your computer and use it in GitHub Desktop.
Use FFmpeg to resize videos
# tested on OSX
# get FFmpeg: brew install ffmpeg
#
# resize source movie (-i parameter) to max width 640px and 128k MP3 audio
# for crf (constant rate factor) see https://trac.ffmpeg.org/wiki/Encode/H.264
#
ffmpeg -i /path/to/source.mp4 \
-vcodec libx264 \
-y -codec:a mp3 -strict -2 -b:a 128k -ar 44100 \
-crf 23 \
-vf scale="'if(gt(iw,640),640,iw)':-1" \
/path/to/destination.mp4 </dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment