#!/usr/bin/env bash INPUT="$1" OUTPUT="${INPUT%.*}.mp4" if [ $# -ne 1 ]; then echo "Usage: vid2twitter [source_video_file]" >&2 exit 1 fi if [ -f "$OUTPUT" ]; then echo -n "$OUTPUT: file exists, overwrite? (y|N) " read -r overwrite case "${overwrite,,}" in "y" | "yes") ;; *) exit 0 ;; esac fi ffmpeg -i "$INPUT" -vcodec libx264 -pix_fmt yuv420p -strict -2 -acodec aac "$OUTPUT"