Add files via upload
This commit is contained in:
parent
fd5867796d
commit
aceedb7e60
9 changed files with 91 additions and 0 deletions
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 Samuel Lord
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
3
image-finder.sh
Normal file
3
image-finder.sh
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
url=$(curl -sS "https://unsplash.com/s/photos/$1?license=free" | grep -o 'href="[^"]*' | grep 'download' | head -n 1 | sed 's/href="//')
|
||||||
|
wget -O "img/$1.$(wget --spider --server-response -O - 'YOUR_URL' 2>&1 | grep -E -o -i 'Content-Type:.*' | cut -d ' ' -f 2 | cut -d ';' -f 1)" "$url"
|
||||||
|
|
2
install-depends-ubuntu.sh
Normal file
2
install-depends-ubuntu.sh
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
curl https://ollama.ai/install.sh | sh
|
||||||
|
sudo apt install imagemagick curl wget
|
14
keywords2images.sh
Normal file
14
keywords2images.sh
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
while IFS= read -r line; do
|
||||||
|
./image-finder.sh "$line"
|
||||||
|
done < script-keywords.txt
|
||||||
|
|
||||||
|
# Navigate to the img/ directory
|
||||||
|
cd img/
|
||||||
|
|
||||||
|
# Find and delete images not divisible by 2
|
||||||
|
find . -type f -exec bash -c 'if [ $(identify -format "%h" "{}")%2 -ne 0 ]; then rm "{}"; fi' \;
|
||||||
|
|
||||||
|
# Return to the original directory (optional)
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
find img -type f -size 0 -delete
|
9
make_video.sh
Normal file
9
make_video.sh
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
./scripter.sh "$1"
|
||||||
|
./keywords2images.sh
|
||||||
|
espeak -f script.txt -w voice.wav
|
||||||
|
ls -1v img/* | while IFS= read -r file; do
|
||||||
|
echo "file '$(echo "$file" | sed "s/'/\\\'/g")'"
|
||||||
|
done > concat.txt
|
||||||
|
sed -i '/\\/d' concat.txt
|
||||||
|
|
||||||
|
./renderer.sh
|
9
make_video_premade_script.sh
Normal file
9
make_video_premade_script.sh
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
./scripter_premade.sh "$1"
|
||||||
|
./keywords2images.sh
|
||||||
|
espeak -f script.txt -w voice.wav
|
||||||
|
ls -1v img/* | while IFS= read -r file; do
|
||||||
|
echo "file '$(echo "$file" | sed "s/'/\\\'/g")'"
|
||||||
|
done > concat.txt
|
||||||
|
sed -i '/\\/d' concat.txt
|
||||||
|
|
||||||
|
./renderer.sh
|
11
renderer.sh
Normal file
11
renderer.sh
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
total_frames=$(wc -l < concat.txt) # Count the total number of frames in concat.txt
|
||||||
|
voice_length=$(ffprobe -i voice.wav -show_entries format=duration -v quiet -of csv="p=0") # Get the length of voice.wav
|
||||||
|
|
||||||
|
# Calculate the correct duration of each frame
|
||||||
|
duration=$(echo "$voice_length / $total_frames" | bc)
|
||||||
|
|
||||||
|
fps=$(echo "scale=2; $total_frames / $voice_length" | bc)
|
||||||
|
|
||||||
|
# Use the corrected duration in the FFmpeg command
|
||||||
|
ffmpeg -r $fps -f concat -safe 0 -i concat.txt -i voice.wav -c:v libx264 -c:a aac -vf "setpts=PTS/1" -pix_fmt yuv420p -shortest output_video.mp4
|
||||||
|
|
11
scripter.sh
Normal file
11
scripter.sh
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
ollama run sparksammy/samantha "Write a video script about $1. Do NOT include title or description. Do not include scene transitions, either. Make yourself anonymous. Do not state your name. Also, do not ask for replies, and do not specify that you are an assistant." > script.txt
|
||||||
|
awk '{ print $2 }' script.txt > script-keywords.txt
|
||||||
|
awk '{ print $4 }' script.txt >> script-keywords.txt
|
||||||
|
awk '{ print $6 }' script.txt >> script-keywords.txt
|
||||||
|
|
||||||
|
mkdir img
|
||||||
|
rm img/*
|
||||||
|
while IFS= read -r line; do
|
||||||
|
./image-finder.sh "$line"
|
||||||
|
done < script-keywords.txt
|
||||||
|
find img -type f -size 0 -delete
|
11
scripter_premade.sh
Normal file
11
scripter_premade.sh
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
echo "$1" > script.txt
|
||||||
|
awk '{ print $2 }' script.txt > script-keywords.txt
|
||||||
|
awk '{ print $4 }' script.txt >> script-keywords.txt
|
||||||
|
awk '{ print $6 }' script.txt >> script-keywords.txt
|
||||||
|
|
||||||
|
mkdir img
|
||||||
|
rm img/*
|
||||||
|
while IFS= read -r line; do
|
||||||
|
./image-finder.sh "$line"
|
||||||
|
done < script-keywords.txt
|
||||||
|
find img -type f -size 0 -delete
|
Loading…
Reference in a new issue