Skip to content

Instantly share code, notes, and snippets.

@JupyterJones
Created August 22, 2023 00:35
Show Gist options
  • Save JupyterJones/61787880dfc6b08cd803334c6ef945f3 to your computer and use it in GitHub Desktop.
Save JupyterJones/61787880dfc6b08cd803334c6ef945f3 to your computer and use it in GitHub Desktop.
This script processes a sequence of images into a video, applies video effects, # adds background music, and generates a final video output
#!/bin/bash
ffmpeg -framerate 17 -i %05d.jpg -c:v libx265 -r 30 -pix_fmt yuv420p -y start.mp4
ls "$(pwd)/start.mp4"
# Print instructions for the user
echo "This script will process a video file located in the current directory."
echo "Please ensure that the 'start.mp4' file exists in this directory before proceeding."
echo "Press ENTER to continue, or CTRL+C to cancel."
read
# Check if start.mp4 exists in the current directory
if [ ! -f "start.mp4" ]; then
echo "Error: 'start.mp4' file not found in current directory."
exit 1
fi
# Process the video file
#!/bin/bash
################################################################################
# SuperEffect Script
#
# This script processes a sequence of images into a video, applies video effects,
# adds background music, and generates a final video output. It provides an
# automated way to create dynamic videos with various effects and music.
#
# Usage: Place the script in the same directory as a sequence of images in
# filename format %05d.jpg (e.g., 00001.jpg, 00002.jpg, ...).
# Run the script and follow the on-screen instructions to create the final
# video with effects and music.
#MUSIC= musi contain the path of the music files you wish to randomly choose and muc
# Author: Jack Northrup
# Date: Tuesday, 22 August, 2023 08:24:28 AM PST
################################################################################
# Rest of the script...
ffmpeg -hide_banner -i "$(pwd)/start.mp4" -filter:v "minterpolate='mi_mode=mci:mc_mode=aobmc:vsbmc=1:fps=10'" -c:v libx264 -r 20 -pix_fmt yuv420p -c:a copy -y "$(pwd)/output2.mp4"
echo "done 1"
ffmpeg -hide_banner -i "$(pwd)/output2.mp4" -filter:v "setpts=7*PTS,minterpolate='fps=25:scd=none:me_mode=bidir:vsbmc=1:search_param=200'" -t 58 -y "$(pwd)/final2.mp4"
echo "done 2"
ffmpeg -hide_banner -i "$(pwd)/final2.mp4" -filter:v "setpts=7*PTS,minterpolate='fps=25:scd=none:me_mode=bidir:vsbmc=1:search_param=200'" -t 58 -y "$(pwd)/final5.mp4"
echo "done 3"
MUSIC=("/home/jack/Desktop/StoryMaker/static/music/Born_a_Rockstar-Instrumental-NEFFEX.mp3" "/home/jack/Desktop/StoryMaker/static/music/Cattle-Telecasted.mp3" "/home/jack/Desktop/StoryMaker/static/music/Bite_Me-Clean-NEFFEX.mp3" "/home/jack/Desktop/StoryMaker/static/music/El_Secreto-Yung_Logos.mp3" "/home/jack/Desktop/StoryMaker/static/music/Blue_Mood-Robert_Munzinger.mp3" "/home/jack/Desktop/StoryMaker/static/music/Escapism-Yung_Logos.mp3" "/home/jack/Desktop/StoryMaker/static/music/Enough-NEFFEX.mp3" "/home/jack/Desktop/StoryMaker/static/music/As_You_Fade_Away-NEFFEX.mp3" "/home/jack/Desktop/StoryMaker/static/music/Culture-Anno_Domini_Beats.mp3" "/home/jack/Desktop/StoryMaker/static/music/Contrast-Anno_Domini_Beats.mp3" "/home/jack/Desktop/StoryMaker/static/music/Diving_in_Backwards-Nathan_Moore.mp3" "/home/jack/Desktop/StoryMaker/static/music/Aztec_Empire-Jimena_Contreras.mp3" "/home/jack/Desktop/StoryMaker/static/music/Devil_s_Organ-Jimena_Contreras.mp3" "/home/jack/Desktop/StoryMaker/static/music/Alpha_Mission-Jimena_Contreras.mp3" "/home/jack/Desktop/StoryMaker/static/music/Changing-NEFFEX.mp3" "/home/jack/Desktop/StoryMaker/static/music/Anxiety-NEFFEX.mp3" "/home/jack/Desktop/StoryMaker/static/music/6-Shots-NEFFEX.mp3" "/home/jack/Desktop/StoryMaker/static/music/DimishedReturns.mp3" "/home/jack/Desktop/StoryMaker/static/music/Drum_Meditation.mp3" "/home/jack/Desktop/StoryMaker/static/music/ChrisHaugen.mp3" "/home/jack/Desktop/StoryMaker/static/music/DoveLove-Moreira.mp3" "/home/jack/Desktop/StoryMaker/static/music/DesertPlanet.mp3" "/home/jack/Desktop/StoryMaker/static/music/David_Fesliyan.mp3")
# Function to get a random number between 50 and 100
get_random_seconds() {
echo $((RANDOM % 51 + 50))
}
# Function to get a random music file from the MUSIC array
get_random_music() {
echo "${MUSIC[$((RANDOM % ${#MUSIC[@]}))]}"
}
# Get random init seconds and music file
init=$(get_random_seconds)
music=$(get_random_music)
# Run ffmpeg command
ffmpeg -i final5.mp4 -ss "$init" -i "$music" -af 'afade=in:st=0:d=4,afade=out:st=55:d=3' -map 0:0 -map 1:0 -shortest -y Final_End.mp4
echo "The process has finished."
vlc Final_End.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment