Created
April 21, 2018 05:47
-
-
Save anasayubi/1248b809c62a345688b7b9cc721c210a to your computer and use it in GitHub Desktop.
View course videos properly
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 | |
# Prereqs: | |
## The lecture video can be given any NAME.EXT for example: first_week_collective_section.mp4 | |
## The slides video must be gviven the name NAME_slides.EXT for example: first_week_collective_section_slides.mp4 | |
## vlc and ffmpeg must be installed | |
# Usage: | |
# The parameter passed to the file must be the lecture video name. To create a final file, the following must be passed: ./open_course first_week_collective_section.mp4 | |
# A final file by the name of final_week_collective_section_final.mp4 will then be created | |
if [[ -r $1 ]] | |
then | |
IFS='.' read -r -a array <<< "$1" | |
if [[ -e "${array[0]}_final.${array[1]}" ]] | |
then | |
vlc ${array[0]}_final.${array[1]} | |
else | |
ffmpeg -i $1 -vn -y -acodec copy output-audio.aac | |
ffmpeg -i "${array[0]}_slides.${array[1]}" -i output-audio.aac -y -c copy -map 0:v:0 -map 1:a:0 "${array[0]}_final.${array[1]}" | |
rm output-audio.aac | |
vlc ${array[0]}_final.${array[1]} | |
#vlc "${array[0]}_slides.${array[1]}" --input-slave=output-audio.aac --audio-track=1 | |
#vlc "${1}" & | |
#vlc "${array[0]}_slides.${array[1]}" & | |
fi | |
else | |
echo "The file specified must exist." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment