Skip to content

Instantly share code, notes, and snippets.

@zipizap
Created December 7, 2013 16:05
Show Gist options
  • Save zipizap/7844410 to your computer and use it in GitHub Desktop.
Save zipizap/7844410 to your computer and use it in GitHub Desktop.
#!/bin/bash
[[ -r $1 ]] || { echo "Usage: $0 <videofile-to-be-resized> [<videofile2> ...]"; exit 1; }
for INPUT_FILE in $@; do
OUTPUT_MP4_FILE=$(echo $INPUT_FILE | sed 's/\.[^.]*$/.mp4/g')
#See https://trac.ffmpeg.org/wiki/x264EncodingGuide
avconv -y -i $INPUT_FILE -threads auto -c:v libx264 -preset medium -b:v 988k -pass 1 -an -f mp4 /dev/null && \
avconv -i $INPUT_FILE -threads auto -c:v libx264 -preset medium -b:v 988k -pass 2 -c:a libmp3lame -b:a 192k $OUTPUT_MP4_FILE
rm -f av2pass* &>/dev/null
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment