Created
August 30, 2016 05:32
-
-
Save philJohnson/c04ae5dff184032a5f4c452268b09023 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generates a cover image along with mute web-ready WebM and MP4 files for each master video in a folder. | |
# See: https://gist.github.com/jaydenseric/220c785d6289bcfd7366. | |
# Parameter 1: Input video format (e.g. "mov"). | |
# Parameter 2: Output width in pixels (e.g. "1280"). | |
# Example use: "./video4web.sh mov 1280". | |
for i in *.$1 | |
do | |
# Generate cover image | |
ffmpeg -i $i -vframes 1 -vf scale=$2:-2 -q:v 1 ${i%$1}jpg | |
# Generate WebM | |
ffmpeg -i $i -c:v libvpx -qmin 0 -qmax 25 -crf 4 -b:v 1M -vf scale=$2:720 -c:a libvorbis -threads 0 ${i%$1}webm | |
# Generate OVG | |
ffmpeg -i $i -codec:v libtheora -vf scale=$2:720 -qscale:v 7 -codec:a libvorbis -qscale:a 5 ${i%$1}ogv | |
# Generate MP4 | |
ffmpeg -i $i -c:v libx264 -pix_fmt yuv420p -profile:v baseline -level 3.0 -crf 22 -preset veryslow -vf scale=$2:720 -c:a aac -strict experimental -movflags +faststart -threads 0 ${i%$1}mp4 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment