Last active
December 18, 2015 20:39
-
-
Save GhostSquad57/5841763 to your computer and use it in GitHub Desktop.
A simple shell script that converts a glc file to mkv
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 | |
# created by GhostSquad57 <https://www.youtube.com/user/GhostSquad57> | |
echo -n "Enter the name of the GLC file: " # prompts the user to enter the file that will be converted | |
read glcfile # this line creates the variable "glcfile" from what the user entered at the prompt | |
echo -e "\nlooking for:" $glcfile | |
if ! [ -e $glcfile ]; then | |
# if file cannot be found, exit 1 | |
echo -e "\n" $glcfile "cannot be found" | |
exit 1 | |
elif [ -e $glcfile ]; then | |
# if file is found, continue on! | |
echo -e "\nfile found!" | |
else | |
# in case pigs fly | |
echo -e "\n unknown error" | |
exit 1 | |
fi | |
# this part is a little hard to explain: | |
# basically, glc-play has the ability to stream the glc file that is playing | |
# the "--yuv4mpeg=" option (seen in line #30) saves the video stream in yuv4mpeg format | |
# the "--wav=" option (seen in line #32) saves the audio stream in wav format | |
# the "-o" option tells glc-play what the filename of the stream shall be | |
# we use "-" as the filename because that tells bash to send the stream to standard input | |
# we then tell avconv to read "-" (standard input) and convert the stream to mkv format | |
echo -e "\nConverting Video... (this may take a while)\n" | |
glc-play $glcfile -o - --yuv4mpeg=1 | ffmpeg -loglevel error -i - -vf "lutyuv=y=val*1.4" -qscale 0 -an -y video.mkv # this line converts the video | |
echo -e "\nConverting Audio... (this may take a while)\n" | |
glc-play $glcfile -o - --wav=1 | ffmpeg -loglevel error -i - -acodec libmp3lame -ab 192000 audio.mp3 # this line converts the audio | |
echo -e "\nDone!" #"\a" | |
# un-comment the above line if you want the system bell to ring at completion | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment