|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
TEXT="Oil painting of a woman in the foreground | pencil art landscape background" |
|
|
|
|
|
FRAMES_IN="/home/nerdy/github/VQGAN-CLIP/VideoFrames" |
|
FRAMES_OUT="/home/nerdy/github/VQGAN-CLIP/Saves/VideoStyleTesting" |
|
|
|
|
|
HEIGHT=640 |
|
WIDTH=360 |
|
|
|
|
|
ITERATIONS=25 |
|
SAVE_EVERY=$ITERATIONS |
|
|
|
|
|
OPTIMISER=Adagrad |
|
LR=0.2 |
|
|
|
|
|
SEED=`shuf -i 1-9999999999 -n 1` |
|
|
|
|
|
|
|
mkdir -p "$FRAMES_IN" |
|
mkdir -p "$FRAMES_OUT" |
|
|
|
|
|
export CUBLAS_WORKSPACE_CONFIG=:4096:8 |
|
|
|
|
|
ffmpeg -y -i "$1" -q:v 2 "$FRAMES_IN"/frame-%04d.jpg |
|
|
|
|
|
ls "$FRAMES_IN" | while read file; do |
|
|
|
FILENAME="$FRAMES_OUT"/"$file"-"out".jpg |
|
|
|
|
|
echo "Input frame: $file" |
|
echo "Style text: $TEXT" |
|
echo "Output file: $FILENAME" |
|
|
|
python generate.py -p "$TEXT" -ii "$FRAMES_IN"/"$file" -o "$FILENAME" -opt "$OPTIMISER" -lr "$LR" -i "$ITERATIONS" -se "$SAVE_EVERY" -s "$HEIGHT" "$WIDTH" -sd "$SEED" -d True |
|
done |
|
|
|
ffmpeg -y -i "$FRAMES_OUT"/frame-%04d.jpg-out.jpg -b:v 8M -c:v h264_nvenc -pix_fmt yuv420p -strict -2 -filter:v "minterpolate='mi_mode=mci:mc_mode=aobmc:vsbmc=1:fps=60'" style_video.mp4 |
|
|