Created
October 1, 2013 05:42
-
-
Save tjb0607/6774313 to your computer and use it in GitHub Desktop.
This file contains 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 | |
echo "Converts an MP3 file and a JPG file into a YouTube-ready MP4 file." | |
echo "usage: jpegmp3mp4.sh <mp3> <jpg> [mp4 dir] [resize & convert to jpeg]" | |
if [[ -z "$3" ]] || [[ "$3" == "False" ]]; then | |
OUTFILE=$(echo "$1"|sed -e s/.mp3//|sed -e s/.ogg//|sed -e s/.flac//|sed -e s/.wav//)".mp4" | |
else | |
OUTFILE="$3/"$(basename "$(echo "$1"|sed -e s/.mp3//|sed -e s/.ogg//|sed -e s/.flac//|sed -e s/.wav//)")".mp4" | |
fi | |
if [[ "$4" == "False" ]] || [[ "$3" == "False" ]]; then | |
image=$2 | |
else | |
convert -resize 1920x1080 "$2" "$PWD/jpgmp3mp4tmp.jpg" | |
image="$PWD/jpgmp3mp4tmp.jpg" | |
echo $4 | |
fi | |
ffmpeg -i "$1" -f image2 -loop 1 -i "$image" -r 24 -c:v libx264 -crf 18 -tune stillimage -c:a aac -strict -2 -b:a 192k -shortest "$OUTFILE" | |
rm "$PWD/jpgmp3mp4tmp.jpg" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment