__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Jean-Baptiste Mardelle <jb@kdenlive.org>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
import datetime
import srt
import sys
import whispertotext
# Call this script with the following arguments
# 1. source av file
# 2. model name (tiny, base, small, medium, large)
# 3. output .srt file
# 4. Device (cpu, cuda)
# 5. translate or transcribe
# 6. Language
# 7. in point (optional)
# 8. out point
# 9. tmp file name to extract a clip's part
def main():
source = sys.argv[1]
model = sys.argv[2]
outfile = sys.argv[3]
device = sys.argv[4]
task = sys.argv[5]
language = sys.argv[6]
if len(sys.argv) > 8:
whispertotext.extract_zone(source, sys.argv[7], sys.argv[8], sys.argv[9])
source = sys.argv[9]
result = whispertotext.run_whisper(source, model, device, task, language)
subs = []
for i in range(len(result["segments"])):
start_time = result["segments"][i]["start"]
end_time = result["segments"][i]["end"]
duration = end_time - start_time
timestamp = f"{start_time:.3f} - {end_time:.3f}"
text = result["segments"][i]["text"]
sub = srt.Subtitle(index=len(subs), content=text, start=datetime.timedelta(seconds=start_time), end=datetime.timedelta(seconds=end_time))
subs.append(sub)
subtitle = srt.compose(subs)
with open(outfile, 'w', encoding='utf8') as f:
f.writelines(subtitle)
return 0
if __name__ == "__main__":
sys.exit(main())
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| checkgpu.py | File | 386 B | 0644 |
|
| checkpackages.py | File | 1.85 KB | 0644 |
|
| otiointerface.py | File | 1.13 KB | 0644 |
|
| speech.py | File | 1.98 KB | 0644 |
|
| speechtotext.py | File | 1.74 KB | 0644 |
|
| whispertosrt.py | File | 1.52 KB | 0644 |
|
| whispertotext.py | File | 2.93 KB | 0644 |
|