26 lines
564 B
Bash
26 lines
564 B
Bash
|
#!/bin/bash
|
||
|
# https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video
|
||
|
# https://github.com/mozilla/TTS
|
||
|
#
|
||
|
|
||
|
if [ -z "$1" ]; then
|
||
|
echo usage: $0 \"filename\" [tempo]
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
FILE=$1
|
||
|
STR=`cat $FILE`
|
||
|
MODEL="tts_models/en/ljspeech/glow-tts"
|
||
|
TEMPO=1.0
|
||
|
|
||
|
if [ -z "$2" ]; then
|
||
|
TEMPO=$TEMPO
|
||
|
else
|
||
|
TEMPO=$2
|
||
|
fi
|
||
|
|
||
|
tts --text "$STR" --model_name "$MODEL" && \
|
||
|
ffmpeg -i tts_output.wav -filter:a "atempo=$TEMPO" -vn ffmpeg_output.wav -y && \
|
||
|
ffmpeg -i ffmpeg_output.wav -acodec mp3 $FILE.mp3 -y && \
|
||
|
ffplay $FILE.mp3 -nodisp -autoexit
|