LG TV App Transcoding SRTs

bump
Still wondering if anyone from Plex has even looked at this issue. There’s a debug message, so it should be easy to locate in the code…

There’s an internal ticket logged to look at this.

Thanks for the update. Hopefully the logs above are useful – let me know if you want me to collect more.

1 Like

Recorded live TV is direct streamed instead of direct played due to issue with playback, specifically the video playing much faster than the audio. I’ve reproduced the same issue in the previous webOS app as well, but the same file plays correctly in other Plex apps.

If you can provide a sample file of a video that direct plays without issues in the previous app I can investigate further.

The Platform Version from Settings: About in the Plex app will also be helpful, though I’ve ran into this problem on multiple webOS versions.

Hi Markus,

Thanks for the response.

WebOS: 3.8.0
“Old” LG App: 4.29.9
“New” LG App: 5.6.1

Quite a while ago I noticed issues with playback of the .ts files. At that point I wrote a post-processing script to re-mux them to .mkv. While I was at it, I also extracted the Closed Captions and created SRTs out of them. I have attached the script (no laughing, I only write code on the side!)
This worked at the files direct played in the LG app.

At some point I noticed that the “new” LG app was Direct Streaming these files giving the “Recorded TV cannot be Direct Played” reason (though they obviously could in the old app).

I tried to create your test files for you, but they are working fine! I tried with both the Plex Transcoder and with FFMpeg.
The “Recorded TV detector” must not be getting flagged. I assumed that it was just looking for MPEG2 video, but that doesn’t seem to be it. What is it looking for to determine if a file is “Recorded TV”?

Investigating further, I simply copy/pasted the entire show file from my Recorded TV folder to my “Random Video Files” folder… and it Direct Played

Is Plex just looking at the file location to determine if it can Direct Play?

I want to reiterate:
All of my Recorded TV files that have been re-containerized into MKV Direct Play perfectly fine in the “Old” Plex App (and other Apps like Emby).
They also seem to play fine if I just move them out of the “Recorded TV” folder.

I have attached the re-continerizing script I use.
I will DM you links to the video files since they are on my Google Drive (and the full length one is massive).

(File removed)

When it’s recorded it’s marked as coming from a DVR source, which is what we’re basing the decision to direct stream on. In your case your remux fixes the issue in the same way, but we don’t differentiate when playing back. That’s a key piece of information I missed from your OP and why it works for you in the old app and XPlay, but not for me in either.

I’ll look into limiting this restriction specifically to .ts files, which should handle the default behaviour as well as yours properly.

Thanks Markus.

The advantage of the pre-conversion to mkv is that then it can Direct Play with SRTs, whereas if it is Direct Streamed, it is very easy to drop back to transcoding.

You say that the decision to Direct Stream is based on it being marked as coming from the DVR Source, but simply moving the same file to a different folder seems to allow Direct Play as well.
But I agree, if the real problem is the mpeg2 .ts files, then hopefully you can just trigger on that.

It’s not the location on disk (you can mix DVR and non-DVR content), but moving a file to another location (such that PMS loses track of it) will result in that information being lost, and treated as any other non-DVR file in your library.

The latest version of the LG TV App (5.7.1) has fixed this. My re-containerized recordings are now Direct Played and turning the SRTs on still works with Direct Play and the performance is good.

That said, anyone who is still using the default .ts containers may still have problems.

My script disappeared from my post above, (probably because they purged the forum of .zip files) so I’ve just included it here. You’ll have to copy paste the python to its own file and then do the same for the ts_modder.bat file.
Requires ccextractor and ffmpeg (and update the directory locations)… and no laughing at my coding :stuck_out_tongue:
Then put the path to ts_modder.bat as your post-processing script under the DVR settings.

ts_mod.py

import time
import sys
import os
from ctypes import windll
import time
import subprocess
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler

def process_file(src_path):
    #the file will be processed there
    print (src_path) #print for debug

    parts = (src_path).split('\\')

    ccextract_str = 'c:\ccextractor\ccextractorwin.exe  -autoprogram  -out=srt -bom -utf8 ' + '\"' + src_path
    ccextract_cmd = ['c:\ccextractor\ccextractorwin.exe', '-autoprogram',  '-out=srt', '-bom', '-utf8', src_path]
    print(ccextract_str + ' ...')
    subprocess.call(ccextract_cmd) #creates srt

    ffmpeg_str = r'c:\ffmpeg\bin\ffmpeg.exe -i ' + src_path + ' -i ' + src_path[:-2] + 'srt ' + \
                 '-map 0 -map 1:s -c:v copy -c:a copy -c:s srt -metadata:s:s:0 language=eng -metadata:s:s:0 handler=\"English\"' + src_path[:-2] + 'mkv'
    ffmpeg_cmd = [r'c:\ffmpeg\bin\ffmpeg.exe', '-i', src_path, '-i', src_path[:-2] + 'srt',
                 '-map', '0', '-map', '1:s', '-c:v', 'copy', '-c:a', 'copy', '-c:s', 'srt',  '-metadata:s:s:0', 'language=eng', '-metadata:s:s:0',
		 'handler=\"English\"', src_path[:-2] + 'mkv']
    print(ffmpeg_str + ' ...')
    subprocess.call(ffmpeg_cmd)

    print('Conversion complete.')

    print('Moving .ts file...')

    parts = (src_path).split('\\')
    filename = parts[-1]

    move_str = 'move "' + src_path + '" ' + r'e:\ts_files'
    move_cmd = ['move', src_path, r'e:\ts_files']
    print(move_str)

    subprocess.call(move_str, shell=True)
        


if __name__ == '__main__':
    args = sys.argv[1:]
    path = args[0]

    process_file(path)

ts_modder.bat

@echo off
echo %*
C:\Python\Python37-32\python.exe e:\ts_mod.py %*

Are we sure 3.7.1 LG WebOS app version is correct, I believe that’s a typo and should be 5.7.1

Yes, good catch, sorry.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.