Last active
September 8, 2024 14:09
-
-
Save mttjohnson/31e9fe018c39bde826ae543bcd0007a7 to your computer and use it in GitHub Desktop.
Revisions
-
mttjohnson revised this gist
Feb 14, 2023 . 2 changed files with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,6 +25,10 @@ Run the script ./vprocess.sh # Run Time Expectations I ran this on a 15 minute video file and it took about 2 hours to process. # Special Thanks To [Alex](https://github.com/djpain) for figuring all this out in the first place and writing the script This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,6 +18,8 @@ for file in input/*; do rm -rf "$(basename "$file")".srt rm -rf "$(basename "$file")".vtt rm -rf "$(basename "$file")".txt rm -rf "$(basename "$file")".json rm -rf "$(basename "$file")".tsv done } -
mttjohnson revised this gist
Feb 14, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,4 +27,4 @@ Run the script # Special Thanks To [Alex](https://github.com/djpain) for figuring all this out in the first place and writing the script -
mttjohnson created this gist
Feb 14, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ # Dependencies Install the following dependencies brew install pipenv brew install ffmpeg pipenv install --python 3.10 # Instructions Activate a pipenv shell and make sure the following python packages are installed pipenv shell --python 3.10 pip3 install ffmpeg-python pip3 install git+https://github.com/openai/whisper.git Setup input/output directories mkdir -p input mkdir -p output Move files you want to process to a directory called "input" Run the script ./vprocess.sh # Special Thanks To (Alex)[https://github.com/djpain] for figuring all this out in the first place and writing the script This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ #!/bin/zsh set -xe language=Turkish model_size=large filenamefunc () { for file in input/*; do echo "$(date) ---------- starting whisper ----------" whisper --model $model_size "$file" --language $language --task translate --fp16 False echo "$(date) ---------- starting ffmpeg ----------" ffmpeg -i "$file" -vf subtitles="$(basename "$file")".srt output/"$(basename "$file" .mp4)"_engsub.mp4 done } cleanup () { for file in input/*; do rm -rf "$(basename "$file")".srt rm -rf "$(basename "$file")".vtt rm -rf "$(basename "$file")".txt done } echo "$(date) ---------- starting filenamefunc ----------" filenamefunc echo "$(date) ---------- starting cleanup ----------" cleanup echo "$(date) ---------- finished ----------"