Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
convert a video to the web video formats: mp4, webm, ogg
#!/bin/bash
# how to use: sh convertVideoToWebVideoFormats.sh fileToConvert.mp4
# how to use for batch conversion: find "$VIDEOS" -name '*.mp4' -exec sh -c 'ffmpeg ... or sh convertV..
input=$1
output=$(echo $1 | sed 's/^\(.*\)\.[a-zA-Z0-9]*$/\1/')
# mp4
ffmpeg -i $input -vcodec h264 -acodec aac -strict -2 -s 1280x720 $output.mp4
# webm
#ffmpeg -i $input -f webm -vcodec libvpx -acodec libvorbis -ab 128000 -crf 22 -s 1280x720 $output.webm
#ffmpeg -i $input -f webm -s 1280x720 $output.webm
ffmpeg -i $input -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis $output.webm
#ogv
ffmpeg2theora $input -o $output.ogv -x 1280 -y 720 --videoquality 5 --audioquality 0 --frontend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.