ressu / kube-plex

Scalable Plex Media Server on Kubernetes -- dispatch transcode jobs as pods on your cluster!
Apache License 2.0
104 stars 23 forks source link

Transcording issues with live TV #30

Open hansaya opened 2 years ago

hansaya commented 2 years ago

I have been having issues getting live TV working and I cannot find any useful info on the logs to troubleshoot.

This is all I got

[Live/08d15b6d-849a-4cb1-xxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxx] Session oaw4zjxxxxxxxxxxx doesn't allow direct play
[Transcoder] http://127.0.0.1:32400/livetv/sessions/xxxxxxxxxxxxxxxxxxxxxxxxx.m3u8?offset=0.000000&X-Plex-Incomplete-Segments=1&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx: Server returned 404 Not Found
[KubePlexProxy] transcode failed [error:exit status 1]

I'm using HDHomeRun for the tuner and perhaps this a issue with transcording pod not being able to access the direct stream?

ressu commented 2 years ago

Oh, that's definitely something I didn't think about when designing the current model. I'm not exactly sure how the live TV access happens, so if you could take a look at the logs in the "console" section and see if the command itself is logged there. That will give me a better idea of what it's actually trying to do.

hansaya commented 2 years ago

Some of the logs when I'm not using the plex k8s jobs

ontent-Length of /transcode/Transcode/Sessions/plex-transcode-ty2p1v4d0khadkt91jf8itg6-cca5ee40-3306-43e6-a55a-6fbf1a28d312/init-stream0.m4s,/transcode/Transcode/Sessions/plex-transcode-ty2p1v4d0khadkt91jf8itg6-cca5ee40-3306-43e6-a55a-6fbf1a28d312/chunk-stream0-00010.m4s is 2352914 (of total: 2352914).
May 13, 2022 17:55:48.126 [0x7f795262ab38] DEBUG - Completed: [10.42.0.0:54956] 200 GET /video/:/transcode/universal/session/ty2p1v4d0khadkt91jf8itg6/0/9.m4s (34 live) GZIP 23ms 2352914 bytes
May 13, 2022 17:55:48.126 [0x7f795262ab38] VERBOSE - [IDLE] Removing (1->0) work item http_download - /video/:/transcode/universal/session/ty2p1v4d0khadkt91jf8itg6/0/9.m4s
May 13, 2022 17:55:48.126 [0x7f795262ab38] VERBOSE - [IDLE] * http_download - /livetv/sessions/3be050dc-6e46-4a6a-a466-7ce8b3cb8594/x0vxindhtxh0n9c3143dw4fr/00012.ts?X-Plex-Incomplete-Segments=1 - 1 active item(s)
May 13, 2022 17:55:48.126 [0x7f795262ab38] VERBOSE - [IDLE] * transcoder - 3be050dc-6e46-4a6a-a466-7ce8b3cb8594 - 1 active item(s)
May 13, 2022 17:55:48.126 [0x7f795262ab38] VERBOSE - [IDLE] * transcoder - 6b75327e-7f51-474b-9f5d-abddf9d2f401 - 1 active item(s)
May 13, 2022 17:55:48.126 [0x7f795262ab38] VERBOSE - [IDLE] * transcoder - ty2p1v4d0khadkt91jf8itg6 - 1 active item(s)

Any specific logs you are looking for?

ressu commented 2 years ago

I'm mostly looking for the arguments to the transcoder. I think the easiest solution here is to add the live transcoding to the forbidden arguments list. That way the processes that are capable of running remotely can still do that and live TV would automatically be processed locally.

Once that is done, we can try and figure out if there is something that we can do to help move the process into a kubeplex job instead.

hansaya commented 2 years ago

Does this helps?

[KubePlexProxy] Transcode requested with command /usr/lib/plexmediaserver/Plex Transcoder, args = [-loglevel debug -loglevel_plex debug -noaccurate_seek -ignore_unknown -scan_all_pmts -1 -rw_timeout 30000000 -reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 30 -fflags +discardcorruptts+fillwallclockdts -probesize 20000000 -i http://172.16.1.72:5004/auto/v29.1 -map 0:V? -codec:V copy -map 0:a? -codec:a copy -map 0:s? -codec:s copy -break_non_keyframes 1 -segment_format mpegts -f ssegment -individual_header_trailer 0 -segment_time 1 -segment_start_number 0 -segment_time_delta 0.25 -segment_list http://127.0.0.1:32400/video/:/transcode/session/xxxxxxxxxx/xxxxxxxxxxxx/manifest?X-Plex-Http-Pipeline=infinite -segment_list_type csv -segment_list_size 5 -segment_list_separate_stream_times 1 -segment_list_unfinished 1 -max_delay 5000000 -map_metadata -1 -map_chapters -1 media-%05d.ts -y -nostats -loglevel quiet -loglevel_plex error -xioerror -progressurl http://127.0.0.1:32400/video/:/transcode/session/xxxxxxxxx/xxxxxxxxxxxxxxxxxxx/progress] 
ressu commented 2 years ago

That is actually very helpful. Just to double confirm that the input URL (172.16.1.72) is your hdhomerun?

I'll see if I can construct a deny entry for this, that way we are one small step closer to enabling kube-plex and we can try to figure out what is blocking the remote transcoder from working in this scenario.

hansaya commented 2 years ago

yep, that's my tuner

ressu commented 1 year ago

Wow, that year sure went by fast. I'm now looking at this issue and I'm trying to understand how the live TV could fail because of remote transcoding. The live TV is accessed over TV and the issue we are seeing seems to be related to talking back to Plex.

I'm also having a bit of difficulty identifying a flag that we could use to block transcoding in this case. The only flag that differentiates the calls from regular transcodes is the http source. But that could happen elsewhere too.

I'm not giving up on this just yet, but wanted to write down my thoughts while I work on other things.

lDucks commented 1 year ago

Maybe this can help? I see this error in Plex console when I try to watch live tv, but I can watch my library media:

[Req#4991/Transcode/.....] [mpeg2video @ 0x7f7593e5a0c0] Invalid frame dimensions 0x0.

and sometimes

[Req#4f16/Grabber/.....] Unknown metadata type: