McCloudS / subgen

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

Issue with Subgen Deployment Using Docker Compose #135

Closed Magnoliar closed 28 minutes ago

Magnoliar commented 12 hours ago

Hello Developer,

I've deployed Subgen, but it doesn't seem to function correctly. I'm using Docker Compose for the deployment and Emby as the playback client. Although the logs indicate that the webhook was successfully received, there's no response. Below is the log output:

subgen | subgen | ========== subgen | == CUDA == subgen | ========== subgen | subgen | CUDA Version 12.3.2 subgen | subgen | Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. subgen | subgen | This container image and its contents are governed by the NVIDIA Deep Learning Container License. subgen | By pulling and using the container, you accept the terms and conditions of this license: subgen | https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license subgen | subgen | A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience. subgen | subgen | WARNING: The NVIDIA Driver was not detected. GPU functionality will not be available. subgen | Use the NVIDIA Container Toolkit to start this container with GPU support; see subgen | https://docs.nvidia.com/datacenter/cloud-native/ . subgen | subgen | subgen.env file not found. Please run prompt_and_save_env_variables() first. subgen | subgen.py exists and UPDATE is set to False, skipping download. subgen | Launching subgen.py subgen | 2024-11-14 09:17:51,205 INFO: Subgen v2024.11.2.126 subgen | 2024-11-14 09:17:51,205 INFO: Starting Subgen with listening webhooks! subgen | 2024-11-14 09:17:51,205 INFO: Transcriptions are limited to running 2 at a time subgen | 2024-11-14 09:17:51,205 INFO: Running 3 threads per transcription subgen | 2024-11-14 09:17:51,205 INFO: Using cpu to encode subgen | 2024-11-14 09:17:51,205 INFO: Using faster-whisper subgen | INFO: Started server process [27] subgen | INFO: Waiting for application startup. subgen | INFO: Application startup complete. subgen | INFO: Uvicorn running on http://0.0.0.0:9320/ (Press CTRL+C to quit) subgen | 2024-11-14 09:19:11,633 DEBUG: Calling on_part_begin with no data subgen | 2024-11-14 09:19:11,633 DEBUG: Calling on_header_field with data[40:52] subgen | 2024-11-14 09:19:11,633 DEBUG: Calling on_header_value with data[54:85] subgen | 2024-11-14 09:19:11,633 DEBUG: Calling on_header_end with no data subgen | 2024-11-14 09:19:11,633 DEBUG: Calling on_header_field with data[87:106] subgen | 2024-11-14 09:19:11,633 DEBUG: Calling on_header_value with data[108:128] subgen | 2024-11-14 09:19:11,633 DEBUG: Calling on_header_end with no data subgen | 2024-11-14 09:19:11,633 DEBUG: Calling on_headers_finished with no data subgen | 2024-11-14 09:19:11,634 DEBUG: Calling on_part_data with data[132:2812] subgen | 2024-11-14 09:19:11,634 DEBUG: Calling on_part_end with no data subgen | 2024-11-14 09:19:11,634 DEBUG: Calling on_end with no data subgen | 2024-11-14 09:19:11,641 DEBUG: Raw response: {"Title":"momo 在 Chrome Windows 上开始播放 大剑 - S1, Ep1 - 大剑 - S01E01 - 第1集","Date":"2024-11-14T09:19:11.5766046Z","Event":"playback.start","User":{"Name":"","Id":""},"Item":{"Name":"大剑 - S01E01 - 第1集","ServerId":"","Id":"","DateCreated":"2023-06-15T13:27:35.0000000Z","Container":"mkv","SortName":"大剑 - S01E01 - 第1集","PremiereDate":"2007-04-03T00:00:00.0000000Z","ExternalUrls":{"Name":"IMDb","Url":"[https://www.imdb.com/title/tt1016857"},{"Name":"TheTVDB","Url":"https://thetvdb.com/?tab=episode&id=330202"},{"Name":"Trakt","Url":"https://trakt.tv/search/imdb/tt1016857"}],"Path":"/downloads/Videos/动漫/大剑 (2007)/Season 1/大剑 - S01E01 - 第1集.mkv","Overview":"。","Taglines":[],"Genres":[],"CommunityRating":8,"RunTimeTicks":13708350000,"Size":205881317,"FileName":"大剑 - S01E01 - 第1集.mkv","Bitrate":1201494,"ProductionYear":2007,"IndexNumber":1,"ParentIndexNumber":1,"RemoteTrailers":[],"ProviderIds":{"Tvdb":"330202","TvRage":"534249","Imdb":"tt1016857"},"IsFolder":false,"ParentId":"65434","Type":"Episode","Studios":[],"GenreItems":[],"TagItems":[],"ParentLogoItemId":"65433","ParentBackdropItemId":"65433","ParentBackdropImageTags":["631a6f3055f85400ecefdb4b55e4d837"],"SeriesName":"大剑","SeriesId":"65433","SeasonId":"65434","PrimaryImageAspectRatio":1.7777777777777777,"SeriesPrimaryImageTag":"36f09c762f27b504122c893772a82d24","SeasonName":"季 1","ImageTags":{"Primary":""},"BackdropImageTags":[],"ParentLogoImageTag":"19bf19a1d520645fd7d257989075830a","ParentThumbItemId":"65433","ParentThumbImageTag":"648a37a12506bff667da1e8039b3cf2d","MediaType":"Video","Width":1920,"Height":1080},"Server":{"Name":"","Id":"","Version":"4.9.0.19"},"Session":{"RemoteEndPoint":"","Client":"Emby Web","DeviceName":"Chrome Windows","DeviceId":"","ApplicationVersion":"4.9.0.19","Id":"*"},"PlaybackInfo":{"PositionTicks":0,"PlaylistIndex":0,"PlaylistLength":25,"PlaySessionId":"b5988549a02f4d2983a91aa1b51385e3"}} subgen | INFO: 192.168.50.36:53104 - "POST /emby HTTP/1.1" 200 OK

Here is my compose.yaml:

version: "2" services: subgen: container_name: subgen tty: true image: mccloud/subgen environment:

I would appreciate any insights into what might be causing the issue.

McCloudS commented 11 hours ago

At a glance, your configuration looks accurate. Attached is an example file through Emby I just ran:

2024-11-15 02:51:34,625 DEBUG: Emby event detected is: playback.start
2024-11-15 02:51:34,625 DEBUG: Path of file: /mnt/user/TV/Billy the Kid/Season 02/Billy the Kid - S02E01 - The Road to Hell.mkv
2024-11-15 02:51:34,648 DEBUG: No subtitles in 'aa' language found in the video.
2024-11-15 02:51:34,649 INFO: Added Billy the Kid - S02E01 - The Road to Hell.mkv for transcription.
2024-11-15 02:51:34,649 INFO: Transcribing file: Billy the Kid - S02E01 - The Road to Hell.mkv
2024-11-15 02:51:34,649 DEBUG: Model was purged, need to re-create
INFO:     192.168.1.111:40182 - "POST /emby HTTP/1.1" 200 OK
2024-11-15 02:52:14,334 INFO: Processing audio with duration 47:31.104
2024-11-15 02:52:27,251 INFO: Detected language 'en' with probability 0.99
Detected Language: english
Transcribe:   1%|          | 19.44/2851.1 [00:00<01:46, 26.64sec/s]2024-11-15 02:52:28,009 DEBUG: Force Update...
Transcribe:   2%|▏         | 58.12/2851.1 [00:06<05:44,  8.10sec/s]2024-11-15 02:52:34,223 DEBUG: Force Update...

Two things I'm expecting to see that I'm not from yours:

Neither of which make sense, because your log shows https://github.com/McCloudS/subgen/blob/4206b8779c8cc1a990e427768c5840f617080a1b/subgen.py#L298 but doesn't show https://github.com/McCloudS/subgen/blob/4206b8779c8cc1a990e427768c5840f617080a1b/subgen.py#L308 so it's failing somewhere in-between those two lines, which really doesn't make sense.

Is there additional console information you can provide? What does the Send Test Notification button do in Emby? It should look like:

2024-11-15 03:05:29,041 DEBUG: Raw response: {"Title":"Test Notification","Description":"Test Notification Description","Date":"2024-11-15T03:05:29.0228297Z","Event":"system.notificationtest","Server":{"Name":"Tower","Id":"2965b319f8a849ebb156e4ea01e9a5c5","Version":"4.8.10.0"}}
2024-11-15 03:05:29,041 DEBUG: Emby event detected is: system.notificationtest
2024-11-15 03:05:29,041 INFO: Emby test message received!
McCloudS commented 11 hours ago

Okay, little bit more testing. Your raw json dump isn't valid json, so Subgen stops executing. You have an errant [ at ExternalUrls What does your webhook settings look like in Emby? I'm on Emby 4.8.10.0 and it's working fine, you seem to be on a beta and not the stable version.

Magnoliar commented 11 hours ago

Thanks alot. I'm currently redeploying Docker, as you know, sometimes strange issues can arise due to the network in China. I'll see if redeploying can solve the problem. My Emby version is 4.9.0.19 beta. Once I complete the deployment, I'll conduct the tests you suggested.

McCloudS commented 11 hours ago

Emby 4.9.0.31-beta appears to work as well. Hopefully an updated version fixes your issue.

Magnoliar commented 11 hours ago

Alright, I have now updated my Emby to 4.9.0.31 and Subgen. I pressed the test notification button, and here is the corresponding log response.Could it be due to the port? image image

McCloudS commented 10 hours ago

I think I found the issue! Emby changed the user agent in the betas, which my test failed. If you update subgen container in about 15 minutes or use UPDATE=True, it will pull the new subgen.py.

Sorry for the confusion, you just found a fun update that Emby made and didn't document in their changelogs.

Magnoliar commented 8 hours ago

It works! image