Skip to content

Instantly share code, notes, and snippets.

@mavimo
Created June 9, 2012 14:47
Show Gist options
  • Save mavimo/2901247 to your computer and use it in GitHub Desktop.
Save mavimo/2901247 to your computer and use it in GitHub Desktop.
Script di conversione video per HTML5
#!/bin/sh
VIDEO_NAME=$1
VIDEO_BASENAME=${VIDEO_NAME%%.*}
THUMB_FOLDER=thumbs
CONVERTED_FOLDER=converted
VIDEO_WIDTH=480
VIDEO_HEIGHT=640
echo "Conversion of $VIDEO_NAME started"
echo "Creating OGV"
ffmpeg2theora --videobitrate 200 -v 8 --max_size 640x480 --output $CONVERTED_FOLDER/$VIDEO_BASENAME.ogv $VIDEO_NAME
echo "Creating MP4"
HandBrakeCLI -O --vb 2000 --width $VIDEO_WIDTH --height $VIDEO_HEIGHT --two-pass --turbo --optimize --input $VIDEO_NAME --output $C$
echo "VP8/Vorbis/WebM"
ffmpeg -pass 1 -passlogfile $VIDEO_NAME -threads 16 -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 10 -i $VIDEO_NAME -vcodec$
ffmpeg -pass 2 -passlogfile $VIDEO_NAME -threads 16 -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 10 -i $VIDEO_NAME -vcodec$
# Remove unused files
rm NUL
rm *.log
# Generate THUMB
ffmpeg -i $VIDEO_NAME -r 1 -an $THUMB_FOLDER/$VIDEO_BASENAME.png
echo "Conversion of $VIDEO_NAME ended"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment