Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
View course videos properly
#!/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
You can’t perform that action at this time.