Last active
October 12, 2016 21:24
-
-
Save julesjans/d7b89ed1c5a8ec0be149288d2eefa891 to your computer and use it in GitHub Desktop.
Converts video (mp4/m4v) into web mp4 & ogv, requires ffmpeg & exiftool
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/sh | |
# VIDEO Conversion Tool | |
# Takes a source directory, and converts for the web into an output directory | |
# Arguments: src, dest | |
# Set the title of the source file | |
# for f in "${1%/}"/*.{mp4,m4v} | |
# do | |
# filename=$(basename "$f") | |
# echo "Preparing $filename:" | |
# exiftool -title="${filename%.*}" -overwrite_original "$f" | |
# echo "Completed $filename." | |
# done | |
# Perform the conversions | |
for f in "${1%/}"/*.{mp4,m4v} | |
do | |
if [ -f "$f" ] | |
then | |
filename=$(basename "$f") | |
echo "Preparing $filename:" | |
# ffmpeg -i "$f" "${2%/}/${filename%.*}_original".mp4 | |
# exiftool -title="${filename%.*}" -overwrite_original "${2%/}/${filename%.*}_original".mp4 | |
ffmpeg -i "$f" -b:v 1200k -b:a 128k "${2%/}/${filename%.*}".mp4 | |
ffmpeg -i "$f" -c:v libtheora -b:v 1200k -c:a libvorbis -b:a 128k "${2%/}/${filename%.*}".ogv | |
exiftool -title="${filename%.*}" -overwrite_original "${2%/}/${filename%.*}".mp4 | |
exiftool -title="${filename%.*}" -overwrite_original "${2%/}/${filename%.*}".ogv | |
echo "Completed $filename." | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment