google / sagetv

SageTV is a cross-platform networked DVR and media management system
http://forums.sagetv.com/
Apache License 2.0
265 stars 174 forks source link

Playback of file crashes when loading external SRT file #467

Open jvl711 opened 2 years ago

jvl711 commented 2 years ago

I think the important part of the log is below. There may have been a problem with the subtitle file. I think it would be a good idea to see if SageTV can handle this failure a little more cleanly.

Fri` 12/17 8:49:19.498 [VideoFrame-4a414f44444a@a55ffe2] openURL0(stv://192.168.0.5/\\brazil\movies\Christmas Story, A (1983)\A Christmas Story_1983_1080p_H264.mkv)
Fri 12/17 8:49:19.499 [VideoFrame-4a414f44444a@a55ffe2] Sigma video dim=java.awt.Dimension[width=720,height=480]
Fri 12/17 8:49:19.499 [VideoFrame-4a414f44444a@a55ffe2] setMute0()
Fri 12/17 8:49:19.501 [VideoFrame-4a414f44444a@a55ffe2] getDuration : 0
Fri 12/17 8:49:19.501 [VideoFrame-4a414f44444a@a55ffe2] VideoFrame.timeSelected2(Fri 11/16 10:40:58.807, true) currFile=MediaFile[id=55562695 A[56516593,55562696,"A Christmas Story",0@1116.10:40,93,V] mask=V host=sagetv encodedBy= format=MATROSKA 1:33:23 12183 kbps [#0 Video[H.264 23.975986 fps 1904x1080 238:135 progressive id=0]#1 Audio[AC3 48000 Hz 1 channels 192 kbps idx=1 id=0 eng]#2 Subpic[SRT id=0 eng]#3 Subpic[SRT id=0 por]#4 Subpic[SRT id=0 spa]#5 Subpic[SRT path=\\brazil\movies\Christmas Story, A (1983)\A Christmas Story_1983_1080p_H264.srt]{MediaType=Movie, metadata.tmdb.id=850, metadata.lastupdated=1615213050195}] \\brazil\movies\Christmas Story, A (1983)\A Christmas Story_1983_1080p_H264.mkv, Seg0[Fri 11/16 10:40:58.807-Fri 11/16 12:14:21.847]] realDur=0
Fri 12/17 8:49:19.501 [VideoFrame-4a414f44444a@a55ffe2] playPush0()
Fri 12/17 8:49:19.503 [VideoFrame-4a414f44444a@a55ffe2] Channel Change Time=1639748959503 NOTE: Not valid if this was not a direct channel change!
Fri 12/17 8:49:19.503 [VideoFrame-4a414f44444a@a55ffe2] VIDEO FRAME EXCEPTION THROWN:java.lang.NullPointerException
Fri 12/17 8:49:19.504 [VideoFrame-4a414f44444a@a55ffe2] java.lang.NullPointerException
Fri 12/17 8:49:19.504 [VideoFrame-4a414f44444a@a55ffe2] java.io.File.<init>(Unknown Source)
Fri 12/17 8:49:19.504 [VideoFrame-4a414f44444a@a55ffe2] sage.media.sub.SRTSubtitleHandler.loadSubtitlesFromFiles(SRTSubtitleHandler.java:248)
Fri 12/17 8:49:19.504 [VideoFrame-4a414f44444a@a55ffe2] sage.media.sub.SRTSubtitleHandler.loadSubtitlesFromFiles(SRTSubtitleHandler.java:131)
Fri 12/17 8:49:19.504 [VideoFrame-4a414f44444a@a55ffe2] sage.media.sub.SubtitleHandler.createSubtitleHandler(SubtitleHandler.java:372)
Fri 12/17 8:49:19.504 [VideoFrame-4a414f44444a@a55ffe2] sage.VideoFrame.processJob(VideoFrame.java:2516)
Fri 12/17 8:49:19.504 [VideoFrame-4a414f44444a@a55ffe2] sage.VideoFrame.run(VideoFrame.java:1614)
Fri 12/17 8:49:19.504 [VideoFrame-4a414f44444a@a55ffe2] sage.Pooler$PooledThread.run(Pooler.java:254)
Narflex commented 2 years ago

It looks like there may be a mix of internal SRT tracks and external SRT files...which if I recall, probably isn't supported. Get rid of the external subtitle file, rescan, and then try again to see if it works.

jvl711 commented 2 years ago

@Narflex

You were correct. I renamed the external .srt file and the error went away. Is there something here I could fix?

Thanks, Josh

Narflex commented 2 years ago

I don't think there's an easy solution at all. You can likely make the crash less of a problem by having this catch Exception rather than IOException: https://github.com/google/sagetv/blob/master/java/sage/media/sub/SRTSubtitleHandler.java#L419

But then subtitles likely won't work with that file. I do recall this being a design decision at some point...subs had to be either external or internal for a file, not both. Although maybe for different sub formats, then they can be either external or internal possibly. I don't really remember anymore. :)