McCloudS / subgen

Autogenerate subtitles using OpenAI Whisper Model via Jellyfin, Plex, Emby, Tautulli, or Bazarr
MIT License
453 stars 45 forks source link

How to get it working on Windows 11 #53

Closed Kev1n121 closed 4 months ago

Kev1n121 commented 4 months ago

I want to get this working with Jellyfin on Windows 11. with dutch subtitles. These are my settings in subgen.py plextoken = os.getenv('PLEXTOKEN', 'token here') plexserver = os.getenv('PLEXSERVER', 'http://192.168.1.111:32400') jellyfintoken = os.getenv('JELLYFINTOKEN', 'apifromtheapiJellyfin i have added') jellyfinserver = os.getenv('JELLYFINSERVER', 'http://192.168.1.241:8096') whisper_model = os.getenv('WHISPER_MODEL', 'medium') whisper_threads = int(os.getenv('WHISPER_THREADS', 4)) concurrent_transcriptions = int(os.getenv('CONCURRENT_TRANSCRIPTIONS', 2)) transcribe_device = os.getenv('TRANSCRIBE_DEVICE', 'cpu') procaddedmedia = convert_to_bool(os.getenv('PROCADDEDMEDIA', True)) procmediaonplay = convert_to_bool(os.getenv('PROCMEDIAONPLAY', True)) namesublang = os.getenv('NAMESUBLANG', 'aa') skipifinternalsublang = os.getenv('SKIPIFINTERNALSUBLANG', 'eng') webhookport = int(os.getenv('WEBHOOKPORT', 9000)) word_level_highlight = convert_to_bool(os.getenv('WORD_LEVEL_HIGHLIGHT', False)) debug = convert_to_bool(os.getenv('DEBUG', True)) use_path_mapping = convert_to_bool(os.getenv('USE_PATH_MAPPING', False)) path_mapping_from = os.getenv('PATH_MAPPING_FROM', '/tv') path_mapping_to = os.getenv('PATH_MAPPING_TO', 'C:/TV Shows') model_location = os.getenv('MODEL_PATH', './models') transcribe_folders = os.getenv('TRANSCRIBE_FOLDERS', '') transcribe_or_translate = os.getenv('TRANSCRIBE_OR_TRANSLATE', 'transcribe') force_detected_language_to = os.getenv('FORCE_DETECTED_LANGUAGE_TO', 'en') hf_transformers = convert_to_bool(os.getenv('HF_TRANSFORMERS', False)) hf_batch_size = int(os.getenv('HF_BATCH_SIZE', 24)) clear_vram_on_complete = convert_to_bool(os.getenv('CLEAR_VRAM_ON_COMPLETE', True)) compute_type = os.getenv('COMPUTE_TYPE', 'auto') append = convert_to_bool(os.getenv('APPEND', False))

I did go to the folder subgen-main and started C:\subgen-main\subgen-main\subgen.py and started this i am getting: INFO: Will watch for changes in these directories: ['C:\Users\hello\Desktop\subgen-main\subgen-main\subgen'] INFO: Uvicorn running on http://0.0.0.0:9000 (Press CTRL+C to quit) INFO: Started reloader process [10856] using StatReload INFO: Started server process [3244] INFO: Waiting for application startup. INFO: Application startup complete.

I have installed it with Standalone/Without Docker : install python3 and ffmpeg and run pip3 install numpy stable-ts fastapi requests faster-whisper uvicorn python-multipart python-ffmpeg whisper transformers optimum accelerate. Then run it: python3 subgen.py. You need to have matching paths relative to your Plex server/folders, or use USE_PATH_MAPPING.

First, you need to install the Jellyfin webhooks plugin. Then you need to click "Add Generic Destination", name it anything you want, webhook url is your subgen info (IE http://192.168.1.154:8090/jellyfin). Next, check Item Added, Playback Start, and Send All Properties. Last, "Add Request Header" and add the Key: Content-Type Value: application/json

I have added http://192.168.1.241:8096 as webhook in Jellyfin. I thicked the Playback Start, Key : Content-Type and Value: application/json

http://192.168.1.241:8096 is my jellyfin server ip. Path mapping I dont know? when I tried the folder of my tv shows. its C:\TV Shows. but when I add that It gives error. I have the Jellyfinserver correct, the Jellyfintoken, I have added the api keys I created a new one and added that apikey. I am still lost what I need to do to get it working. Hope someone can help me with this because I am totally new with this stuff.

McCloudS commented 4 months ago

You IPs and ports are wrong between your subgen and jellyfin server. What operating system is your Jellyfin running on and what are your paths to your media relative to your windows machine and Jellyfin server?

Kev1n121 commented 4 months ago

You IPs and ports are wrong between your subgen and jellyfin server. What operating system is your Jellyfin running on and what are your paths to your media relative to your windows machine and Jellyfin server?

Thank you for your comment, my operating system is windows 11, the Jellyfin server is running on http://192.168.1.241:8096/web/index.html#!/home.html I am running it as a service and installed it as service, I have my media on C:\TV Shows and C:\Movies as this the same as jellyfin path I have the libraries at. I now have changed the media C:\TV Shows and C:\Movies in the same folder so now it is C:\media is my media path now.

C:\Users\hello\Desktop\subgen-main\subgen-main\subgen\subgen.py:48: SyntaxWarning: invalid escape sequence '\M' path_mapping_from = os.getenv('PATH_MAPPING_FROM', 'C:\Media') C:\Users\hello\Desktop\subgen-main\subgen-main\subgen\subgen.py:49: SyntaxWarning: invalid escape sequence '\M' path_mapping_to = os.getenv('PATH_MAPPING_TO', 'C:\Media') C:\Users\hello\Desktop\subgen-main\subgen-main\subgen\subgen.py:48: SyntaxWarning: invalid escape sequence '\M' path_mapping_from = os.getenv('PATH_MAPPING_FROM', 'C:\Media') C:\Users\hello\Desktop\subgen-main\subgen-main\subgen\subgen.py:49: SyntaxWarning: invalid escape sequence '\M' path_mapping_to = os.getenv('PATH_MAPPING_TO', 'C:\Media')

McCloudS commented 4 months ago

Yeah, I didn't account for windows file paths, so they are probably not escaped properly. I just updated the script to (maybe) fix it. I don't have a Windows machine to test on. If you are running subgen and jellyfin on the same computer, you won't need the path mapping, just delete it.

Your webhook address in jellyfin may be wrong. You need it to point back to your subgen instance/ip. Should be something like: http://192.168.1.241:9000/jellyfin

Kev1n121 commented 4 months ago

Its working now. But is it normal that it takes long to Transcribe its not working right away right?

McCloudS commented 4 months ago

If you’re on pure CPU, it’ll probably take about the length of the file or longer. If you have an nvidia GPU, you can install the drivers and it will be faster.

Kev1n121 commented 4 months ago

alright, thank you for your help and work. But I just have a simple mini pc where i am running it on. So its no go for me. Its realy stressing my mini pc lol. So now I have also tested it and now I know what I can do with it. I thought It just works very simple but not:)

McCloudS commented 4 months ago

A smaller model will run faster (tiny, small, or base), but a CPU is really the limiting factor for anything AI right now.

Kev1n121 commented 4 months ago

Thank you for your fast instant comments never had such a fast support on github ever,