Skip to content

Instantly share code, notes, and snippets.

@briandemant
Created May 6, 2009 21:50
Show Gist options
  • Save briandemant/107765 to your computer and use it in GitHub Desktop.
Save briandemant/107765 to your computer and use it in GitHub Desktop.
video encoding scripts
#! /bin/bash
#
# this doesn't get ALL frames, it just grabs one!
#
# see: http://stream0.org/2008/02/howto-extract-images-from-a-vi.html
# for howto extract other images or ... do other stuff
#
INPUT="$1"
OUTPUT="$2"
if [[ -f "$INPUT" ]] && [[ -n "$OUTPUT" ]]; then
ffmpeg -i $INPUT -r 1 -t 00:00:01 -f image2 $OUTPUT
else
echo "Usage: ogg2png foo.ogv foo.png"
fi
#! /bin/bash
INPUT="$1"
OUTPUT="$2"
if [[ -f "$INPUT" ]] && [[ -n "$OUTPUT" ]]; then
mencoder $INPUT -o $OUTPUT -oac mp3lame -ovc lavc
else
echo "Usage: ogg2avi foo.ogg foo.avi"
fi
#! /bin/bash
INPUT="$1"
OUTPUT="$2"
OPTION="$3"
if [[ -f "$INPUT" ]] && [[ -n "$OUTPUT" ]]; then
if [[ -n "$OPTION" ]]; then
if [[ "$OPTION" = "--simple" ]]; then
echo "creating simple mp4"
ffmpeg -i $INPUT -vcodec libx264 $OUTPUT
exit
fi
fi
ffmpeg -i "$INPUT" -vcodec libx264 -g 250 -coder ac -me_method full -me_range 16 -subq 5 -sc_threshold 40 -acodec libfaac -ab 96000 -ar 22500 -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -i_qfactor 0.71 -b_strategy 1 -crf 30 -y "$OUTPUT"
# simple: ffmpeg -i yourinputvideo.ogv -vcodec libx264 output.mp4
# whole: ffmpeg -i "$INPUT" -vcodec libx264 -s 800x592 -r 15 -g 250 -keyint_min 25 -coder ac -me_method full -me_range 16 -subq 5 -sc_threshold 40 -acodec libfaac -ab 96000 -ar 22500 -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -i_qfactor 0.71 -b_strategy 1 -crf 30 -y "$OUTPUT"
else
echo "Usage: ogg2mp4 foo.ogg foo.mp4 [--simple]"
fi
#! /bin/bash
INPUT="$1"
OUTPUT="$2"
if [[ -f "$INPUT" ]] && [[ -n "$OUTPUT" ]]; then
nice -n 19 mencoder $INPUT \
-oac mp3lame -lameopts abr:br=92 \
-ovc xvid -xvidencopts pass=2:bitrate=150 \
-o $OUTPUT
else
echo "Usage: ogg2xvid foo.ogg foo.avi"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment