munnerz/kube-plex

Unable to transcode EAC3 audio

Opened this issue · 6 comments

I'm having trouble and I think I'm a bit out of my depths. Where is the configuration of the transcode pods held or defined? I'd liek to try some things to try and get the EasyAudioEncoder to work as it's trying to do things in /tmp on both the PMS instance and the transcode pods. It's not using /transcode for the audio.

For some context here are the errors in the plex console.

Job running: EAE_ROOT='/tmp/pms-d4a0cd44-31b5-42a2-8b7b-87235833786c/EasyAudioEncoder' FFMPEG_EXTERNAL_LIBS='/config/Library/Application\ Support/Plex\ Media\ Server/Codecs/99c90e0-3084-linux-x86_64/' XDG_CACHE_HOME='/config/Library/Application Support/Plex Media Server/Cache' XDG_DATA_HOME='/usr/lib/plexmediaserver/Resources' X_PLEX_TOKEN='xxxxxxxxxxxxxxxxxxxx' '/usr/lib/plexmediaserver/Plex Transcoder' '-codec:0' 'h264' '-codec:2' 'eac3_eae' '-eae_prefix:2' 'rnft5v12sq8x7ate39hmdnrz_' '-ss' '0' '-noaccurate_seek' '-analyzeduration' '20000000' '-probesize' '20000000' '-i' '/data/Video/TV/Show.mkv' '-filter_complex' '[0:2] aresample=async=1:ocl='\''stereo'\'':osr=48000[0]' '-map' '0:0' '-metadata:s:0' 'language=eng' '-codec:0' 'copy' '-map' '[0]' '-metadata:s:1' 'language=eng' '-codec:1' 'aac' '-b:1' '256k' '-f' 'dash' '-seg_duration' '5' '-init_seg_name' 'init-stream$RepresentationID$.m4s' '-media_seg_name' 'chunk-stream$RepresentationID$-$Number%05d$.m4s' '-window_size' '5' '-delete_removed' 'false' '-skip_to_segment' '1' '-time_delta' '0.0625' '-manifest_name' 'http://127.0.0.1:32400/video/:/transcode/session/rnft5v12sq8x7ate39hmdnrz/78be1816-19e6-4190-a0d7-f67eb0e7e87a/manifest?X-Plex-Http-Pipeline=infinite' '-avoid_negative_ts' 'disabled' '-map_metadata' '-1' '-map_chapters' '-1' 'dash' '-start_at_zero' '-copyts' '-vsync' 'cfr' '-y' '-nostats' '-loglevel' 'quiet' '-loglevel_plex' 'error' '-progressurl' 'http://127.0.0.1:32400/video/:/transcode/session/rnft5v12sq8x7ate39hmdnrz/78be1816-19e6-4190-a0d7-f67eb0e7e87a/progress'

and then

[Transcoder] [eac3_eae @ 0x1be8300] EAE watchfolder is not writable: /tmp/pms-d4a0cd44-31b5-42a2-8b7b-87235833786c/EasyAudioEncoder/Convert to WAV (to 8ch or less)/rnft5v12sq8x7ate39hmdnrz_1-0-test.tmp

I'm happy to hack at this on my own however I don't know where to begin.

Not sure if this is true, but this very old comment indicated that at one point in time EAE looked to be hardcoded to use /tmp - https://github.com/wnielson/Plex-Remote-Transcoder/blob/master/prt.py#L324

Try adding the environment variable TMPDIR to the container and point it to /transcode
From looking at some environment variables being used by Plex on a QNAP NAS, that is one of the one's they are setting and it does look like at least some things in PLEX will honor it. Good Luck

I couldn't get the TMPDIR to work but forcing the /tmp to be mounted to the same pvc as the transcode did the trick for me. Also had to edit the shim to spin up the transcode pod with the same /tmp being mapped to the transcode pvc and it works like a champ.

I couldn't get the TMPDIR to work but forcing the /tmp to be mounted to the same pvc as the transcode did the trick for me. Also had to edit the shim to spin up the transcode pod with the same /tmp being mapped to the transcode pvc and it works like a champ.

This is exactly what I was trying to do however I couldn't figure out how to hack it in. Still learning on how the shim part works and what/where to edit to tell it to use the Transcode PVC.

@typeon3g I can give you my compiled shim and the config i used to get the deployment and replica set up and running. it might take a little tweeking to get right as i am using some distributed storage for my volumes but it should be pretty simple ifn you trust me ;)

The shim was easy to make a change to here is the diff:

--- a/main.go
+++ b/main.go
@@ -132,6 +132,10 @@ func generatePod(cwd string, env []string, args []string) *corev1.Pod {
                                                        Name:      "transcode",
                                                        MountPath: "/transcode",
                                                },
+                                               {
+                                                       Name:      "transcode",
+                                                       MountPath: "/tmp",
+                                               },
                                        },
                                },
                        },

Where my changes to the deployment.yaml are here. I left the old copy of the kube-plex to /shared but i replaced the location to pull from to my downloads mount . I am also including the UID and GID changes because why not.

--- a/charts/kube-plex/templates/deployment.yaml
+++ b/charts/kube-plex/templates/deployment.yaml
@@ -56,6 +56,7 @@ spec:
 {{- if .Values.kubePlex.enabled }}
         # We replace the PMS binary with a postStart hook to save having to
         # modify the default image entrypoint.
+        #        #cp /shared/kube-plex '/usr/lib/plexmediaserver/Plex Transcoder'
         lifecycle:
           postStart:
             exec:
@@ -66,7 +67,7 @@ spec:
                 #!/bin/bash
                 set -e
                 rm -f '/usr/lib/plexmediaserver/Plex Transcoder'
-                cp /shared/kube-plex '/usr/lib/plexmediaserver/Plex Transcoder'
+                cp /data/downloads/kube-plex '/usr/lib/plexmediaserver/Plex Transcoder'
 {{- end }}
         readinessProbe:
           httpGet:
@@ -88,6 +89,14 @@ spec:
           - name: https
             containerPort: 32443
         env:
+{{- if .Values.plex.uid }}
+        - name: PLEX_UID
+          value: "{{.Values.plex.uid}}"
+{{- end }}
+{{- if .Values.plex.gid }}
+        - name: PLEX_GID
+          value: "{{.Values.plex.gid}}"
+{{- end }}
         - name: TZ
           value: "{{ .Values.timezone }}"
         # TODO: move this to a secret?
@@ -98,6 +107,8 @@ spec:
           value: http://{{ template "fullname" . }}:32400
         - name: PMS_IMAGE
           value: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
+        - name: TMP
+          value: "/transcode"
         - name: KUBE_NAMESPACE
           valueFrom:
             fieldRef:
@@ -147,6 +158,8 @@ spec:
         {{ end }}
         - name: transcode
           mountPath: /transcode
+        - name: transcode
+          mountPath: /tmp
         {{- if .Values.persistence.transcode.subPath }}
           subPath: {{ .Values.persistence.transcode.subPath }}
         {{ end }}
@@ -163,6 +176,8 @@ spec:
 {{ toYaml .Values.nodeSelector | indent 8 }}
     {{- end }}
       volumes:
+      - name: tmp
+        emptyDir: {}
       - name: data
         persistentVolumeClaim:
 {{- if .Values.persistence.data.claimName }}