The Stability Update 1.
Add a hacky fix for the non-mutliple-of-two width/height scenerio.
This commit is contained in:
parent
8ae05a40a4
commit
902521ffc3
6 changed files with 41 additions and 25 deletions
|
@ -5,12 +5,31 @@ done < script-keywords.txt
|
||||||
# Navigate to the img/ directory
|
# Navigate to the img/ directory
|
||||||
cd img/
|
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' \;
|
|
||||||
|
|
||||||
|
|
||||||
# Find files with 0 size
|
# Find files with 0 size
|
||||||
find . -type f -size 0 -delete
|
find . -type f -size 0 -delete
|
||||||
|
|
||||||
# Return to the original directory (optional)
|
# Return to the original directory
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
# Add our images to the concat file.
|
||||||
|
ls -1v img/* | while IFS= read -r file; do
|
||||||
|
echo "file '$(echo "$file" | sed "s/'/\\\'/g")'"
|
||||||
|
done > concat.txt
|
||||||
|
sed -i '/\\/d' concat.txt
|
||||||
|
|
||||||
|
# Resize images in img folder to multiple of 2.
|
||||||
|
|
||||||
|
for image in img/*; do
|
||||||
|
# Use identify to get the width and height of the image
|
||||||
|
width=$(identify -format "%w" "$image")
|
||||||
|
height=$(identify -format "%h" "$image")
|
||||||
|
|
||||||
|
# Calculate the nearest multiple of 2 for width and height
|
||||||
|
new_width=$((width + (2 - (width % 2)) % 2))
|
||||||
|
new_height=$((height + (2 - (height % 2)) % 2))
|
||||||
|
|
||||||
|
# Resize the image to the nearest multiple of 2
|
||||||
|
convert "$image" -resize "${new_width}x${new_height}" "$image"
|
||||||
|
|
||||||
|
echo "Resized $image to ${new_width}x${new_height}"
|
||||||
|
done
|
|
@ -1,9 +1,4 @@
|
||||||
./scripter.sh "$1"
|
./scripter.sh "$1"
|
||||||
./keywords2images.sh
|
./keywords2images.sh
|
||||||
espeak -f script.txt -w voice.wav
|
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
|
./renderer.sh
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
./scripter_premade.sh "$1"
|
./scripter_premade.sh "$1"
|
||||||
./keywords2images.sh
|
./keywords2images.sh
|
||||||
espeak -f script.txt -w voice.wav
|
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
|
./renderer.sh
|
||||||
|
|
15
renderer.sh
15
renderer.sh
|
@ -1,3 +1,18 @@
|
||||||
|
# Specify the directory containing your images
|
||||||
|
image_directory="img/"
|
||||||
|
|
||||||
|
# Iterate over each image in the directory
|
||||||
|
for image in "$image_directory"/*; do
|
||||||
|
# Use identify to get the width of the image
|
||||||
|
width=$(identify -format "%w" "$image")
|
||||||
|
|
||||||
|
# Check if the width is not divisible by 2
|
||||||
|
if [ $((width % 2)) -ne 0 ]; then
|
||||||
|
echo "Deleting $image (width: $width)"
|
||||||
|
rm "$image"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
total_frames=$(wc -l < concat.txt) # Count the total number of frames in concat.txt
|
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
|
voice_length=$(ffprobe -i voice.wav -show_entries format=duration -v quiet -of csv="p=0") # Get the length of voice.wav
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,3 @@ awk '{ print $6 }' script.txt >> script-keywords.txt
|
||||||
|
|
||||||
mkdir img
|
mkdir img
|
||||||
rm img/*
|
rm img/*
|
||||||
while IFS= read -r line; do
|
|
||||||
./image-finder.sh "$line"
|
|
||||||
done < script-keywords.txt
|
|
||||||
find img -type f -size 0 -delete
|
|
||||||
|
|
|
@ -5,7 +5,3 @@ awk '{ print $6 }' script.txt >> script-keywords.txt
|
||||||
|
|
||||||
mkdir img
|
mkdir img
|
||||||
rm 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